Skip to content

Commit 2f75916

Browse files
author
Josh Hoyt
committed
[project @ Added tests for checking whether or not a Service Endpoint is for an]
OP identifier
1 parent 4aa832e commit 2f75916

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎openid/test/test_discover.py‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,39 @@ def runOneTest(self):
549549
discover.OPENID_2_0_TYPE]),
550550
]
551551

552+
class TestIsOPIdentifier(unittest.TestCase):
553+
def setUp(self):
554+
self.endpoint = discover.OpenIDServiceEndpoint()
555+
556+
def test_none(self):
557+
self.failIf(self.endpoint.isOPIdentifier())
558+
559+
def test_openid1_0(self):
560+
self.endpoint.type_uris = [discover.OPENID_1_0_TYPE]
561+
self.failIf(self.endpoint.isOPIdentifier())
562+
563+
def test_openid1_1(self):
564+
self.endpoint.type_uris = [discover.OPENID_1_1_TYPE]
565+
self.failIf(self.endpoint.isOPIdentifier())
566+
567+
def test_openid2(self):
568+
self.endpoint.type_uris = [discover.OPENID_2_0_TYPE]
569+
self.failIf(self.endpoint.isOPIdentifier())
570+
571+
def test_openid2OP(self):
572+
self.endpoint.type_uris = [discover.OPENID_IDP_2_0_TYPE]
573+
self.failUnless(self.endpoint.isOPIdentifier())
574+
575+
def test_multipleMissing(self):
576+
self.endpoint.type_uris = [discover.OPENID_2_0_TYPE,
577+
discover.OPENID_1_0_TYPE]
578+
self.failIf(self.endpoint.isOPIdentifier())
579+
580+
def test_multiplePresent(self):
581+
self.endpoint.type_uris = [discover.OPENID_2_0_TYPE,
582+
discover.OPENID_1_0_TYPE,
583+
discover.OPENID_IDP_2_0_TYPE]
584+
self.failUnless(self.endpoint.isOPIdentifier())
552585

553586
def pyUnitTests():
554587
return datadriven.loadTests(__name__)

0 commit comments

Comments
 (0)