Sha256: ce9a38cda0bbd361c2f03a462aa88230978808a05cef31b0144b31795ea0dfe9

Contents?: true

Size: 1.72 KB

Versions: 16

Compression:

Stored size: 1.72 KB

Contents

require File.expand_path('../test_helper', __FILE__)
require 'oauth/signature/plaintext'

class TestSignaturePlaintext < Test::Unit::TestCase
  def test_that_plaintext_implements_plaintext
    assert OAuth::Signature.available_methods.include?('plaintext')
  end

  def test_that_get_request_from_oauth_test_cases_produces_matching_signature
    request = Net::HTTP::Get.new('/photos?file=vacation.jpg&size=original&oauth_version=1.0&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_token=nnch734d00sl2jdk&oauth_signature=kd94hf93k423kf44%26&oauth_timestamp=1191242096&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=PLAINTEXT')

    consumer = OAuth::Consumer.new('dpf43f3p2l4k3l03','kd94hf93k423kf44')
    token = OAuth::Token.new('nnch734d00sl2jdk', nil)

    assert OAuth::Signature.verify(request, { :consumer => consumer,
                                                :token => token,
                                                :uri => 'http://photos.example.net/photos' } )
  end

  def test_that_get_request_from_oauth_test_cases_produces_matching_signature_part_two
    request = Net::HTTP::Get.new('/photos?file=vacation.jpg&size=original&oauth_version=1.0&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_token=nnch734d00sl2jdk&oauth_signature=kd94hf93k423kf44%26pfkkdhi9sl3r4s00&oauth_timestamp=1191242096&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=PLAINTEXT')

    consumer = OAuth::Consumer.new('dpf43f3p2l4k3l03','kd94hf93k423kf44')
    token = OAuth::Token.new('nnch734d00sl2jdk', 'pfkkdhi9sl3r4s00')

    assert OAuth::Signature.verify(request, { :consumer => consumer,
                                                :token => token,
                                                :uri => 'http://photos.example.net/photos' } )
  end

end

Version data entries

16 entries across 15 versions & 7 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/oauth-0.4.7/test/test_signature_plain_text.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/oauth-0.4.7/test/test_signature_plain_text.rb
oauth-ap-0.4.8 test/test_signature_plain_text.rb
oauth-instructure-0.4.10 test/test_signature_plain_text.rb
oauth_weshays-0.4.8.pre2 test/test_signature_plain_text.rb
oauth_weshays-0.4.8.pre test/test_signature_plain_text.rb
oauth-instructure-0.4.9 test/test_signature_plain_text.rb
oauth-instructure-0.4.8 test/test_signature_plain_text.rb
oauth-0.4.7 test/test_signature_plain_text.rb
motionbox-oauth-0.4.5 test/test_signature_plain_text.rb
oauth-0.4.6 test/test_signature_plain_text.rb
oauth-0.4.5 test/test_signature_plain_text.rb
sayso-oauth-0.4.4.001 test/test_signature_plain_text.rb
oauth-0.4.4 test/test_signature_plain_text.rb
oauth-0.4.3 test/test_signature_plain_text.rb
oauth-0.4.2 test/test_signature_plain_text.rb