Sha256: 337645aace0a2b9d3ea0fe5c7439a0e769b93a3a0ecbb41776b892bd75a2310c

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

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

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

4 entries across 4 versions & 1 rubygems

Version Path
ruby-openid-2.6.0 test/test_extension.rb
ruby-openid-2.5.0 test/test_extension.rb
ruby-openid-2.4.0 test/test_extension.rb
ruby-openid-2.3.0 test/test_extension.rb