File: test_signature_base.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 (33 lines) | stat: -rw-r--r-- 800 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
require File.expand_path('../../test_helper', __FILE__)

require 'oauth/signature/base'
require 'net/http'

class SignatureBaseTest < Minitest::Test

  def test_that_initialize_requires_one_request_argument
    assert_raises ArgumentError do
      OAuth::Signature::Base.new()
    end
  end

  def test_that_initialize_requires_a_valid_request_argument
    request = nil
    assert_raises TypeError do
      OAuth::Signature::Base.new(request) { |token|
        # just a stub
      }
    end
  end

  def test_that_initialize_succeeds_when_the_request_proxy_is_valid
    # this isn't quite valid, but it will do.
    raw_request = Net::HTTP::Get.new('/test')
    request = OAuth::RequestProxy.proxy(raw_request)

    OAuth::Signature::Base.new(request) { |token|
      # just a stub
    }
  end

end