1 from openid
import extension
2 from openid
import message
6 class DummyExtension(extension
.Extension
):
7 ns_uri
= 'http://an.extension/'
10 def getExtensionArgs(self
):
13 class ToMessageTest(unittest
.TestCase
):
14 def test_OpenID1(self
):
15 oid1_msg
= message
.Message(message
.OPENID1_NS
)
16 ext
= DummyExtension()
17 ext
.toMessage(oid1_msg
)
18 namespaces
= oid1_msg
.namespaces
19 self
.failUnless(namespaces
.isImplicit(DummyExtension
.ns_uri
))
21 DummyExtension
.ns_uri
,
22 namespaces
.getNamespaceURI(DummyExtension
.ns_alias
))
23 self
.failUnlessEqual(DummyExtension
.ns_alias
,
24 namespaces
.getAlias(DummyExtension
.ns_uri
))
26 def test_OpenID2(self
):
27 oid2_msg
= message
.Message(message
.OPENID2_NS
)
28 ext
= DummyExtension()
29 ext
.toMessage(oid2_msg
)
30 namespaces
= oid2_msg
.namespaces
31 self
.failIf(namespaces
.isImplicit(DummyExtension
.ns_uri
))
33 DummyExtension
.ns_uri
,
34 namespaces
.getNamespaceURI(DummyExtension
.ns_alias
))
35 self
.failUnlessEqual(DummyExtension
.ns_alias
,
36 namespaces
.getAlias(DummyExtension
.ns_uri
))