File: test_server.rb

package info (click to toggle)
ruby-oauth 0.5.4-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 584 kB
  • sloc: ruby: 4,070; makefile: 4
file content (42 lines) | stat: -rw-r--r-- 1,455 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require File.expand_path('../../test_helper', __FILE__)

require 'oauth/server'

class ServerTest < Minitest::Test
  def setup
    @server=OAuth::Server.new "http://test.com"
  end

  def test_default_paths
    assert_equal "/oauth/request_token",@server.request_token_path
    assert_equal "/oauth/authorize",@server.authorize_path
    assert_equal "/oauth/access_token",@server.access_token_path
  end

  def test_default_urls
    assert_equal "http://test.com/oauth/request_token",@server.request_token_url
    assert_equal "http://test.com/oauth/authorize",@server.authorize_url
    assert_equal "http://test.com/oauth/access_token",@server.access_token_url
  end

  def test_generate_consumer_credentials
    consumer=@server.generate_consumer_credentials
    assert consumer.key
    assert consumer.secret
  end

  def test_create_consumer
    @consumer=@server.create_consumer
    assert @consumer
    assert @consumer.key
    assert @consumer.secret
    assert_equal "http://test.com",@consumer.site
    assert_equal "/oauth/request_token",@consumer.request_token_path
    assert_equal "/oauth/authorize",@consumer.authorize_path
    assert_equal "/oauth/access_token",@consumer.access_token_path
    assert_equal "http://test.com/oauth/request_token",@consumer.request_token_url
    assert_equal "http://test.com/oauth/authorize",@consumer.authorize_url
    assert_equal "http://test.com/oauth/access_token",@consumer.access_token_url
  end

end