Sha256: 6a825f4528e8cb10c0d4ab4223a81e1615a00144655ed071dbb7e8ec4e9c38eb

Contents?: true

Size: 1.34 KB

Versions: 9

Compression:

Stored size: 1.34 KB

Contents

require 'openid/extension'
require 'openid/message'
require 'test/unit'

module OpenID
  class DummyExtension < OpenID::Extension
    TEST_URI = 'http://an.extension'
    TEST_ALIAS = 'dummy'
    def initialize
      @ns_uri = TEST_URI
      @ns_alias = TEST_ALIAS
    end

    def get_extension_args
      return {}
    end
  end

  class ToMessageTest < Test::Unit::TestCase
     def test_OpenID1
       oid1_msg = Message.new(OPENID1_NS)
       ext = DummyExtension.new
       ext.to_message(oid1_msg)
       namespaces = oid1_msg.namespaces
       assert(namespaces.implicit?(DummyExtension::TEST_URI))
       assert_equal(
                    DummyExtension::TEST_URI,
                    namespaces.get_namespace_uri(DummyExtension::TEST_ALIAS))
       assert_equal(DummyExtension::TEST_ALIAS,
                    namespaces.get_alias(DummyExtension::TEST_URI))
     end
 
     def test_OpenID2
       oid2_msg = Message.new(OPENID2_NS)
       ext = DummyExtension.new
       ext.to_message(oid2_msg)
       namespaces = oid2_msg.namespaces
       assert(!namespaces.implicit?(DummyExtension::TEST_URI))
       assert_equal(
             DummyExtension::TEST_URI,
             namespaces.get_namespace_uri(DummyExtension::TEST_ALIAS))
       assert_equal(DummyExtension::TEST_ALIAS,
                    namespaces.get_alias(DummyExtension::TEST_URI))
     end
   end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
pelle-ruby-openid-2.1.8 test/test_extension.rb
nov-ruby-openid-2.1.9 test/test_extension.rb
ruby-openid-2.1.8 test/test_extension.rb
pelle-ruby-openid-2.1.9 test/test_extension.rb
ruby-openid-2.1.7 test/test_extension.rb
ruby-openid-2.1.2 test/test_extension.rb
ruby-openid-2.1.6 test/test_extension.rb
ruby-openid-2.1.5 test/test_extension.rb
ruby-openid-2.1.4 test/test_extension.rb