Blame SOURCES/duplicate-python-LogoutTestCase.patch

0f20f5
commit 623d785f957acc9eccb47a9a3f88e5e167a370b6
0f20f5
Author: John Dennis <jdennis@redhat.com>
0f20f5
Date:   Mon Jun 25 17:37:45 2018 -0400
0f20f5
0f20f5
    fix duplicate definition of LogoutTestCase and logoutSuite
0f20f5
    
0f20f5
    Commit 6f617027e added a duplicate definition of the LogoutTestCase
0f20f5
    class containing only 1 test which shaddowed the original
0f20f5
    LogoutTestCase containing 4 tests. The logoutSuite variable was also
0f20f5
    shadowed and the allTests variable contained a duplicate of
0f20f5
    logoutSuite causing the 2nd definition of LogoutTestCase to be run
0f20f5
    twice.
0f20f5
    
0f20f5
    Not only were the original 4 tests not being run but the entire unit
0f20f5
    test in profiles_tests.py was failing under Python3. This is because
0f20f5
    the unittest code in Py3 deletes a test from it's list of tests to run
0f20f5
    once it's been run. The second time the logoutSuite was invoked it no
0f20f5
    longer contained any tests which caused an exception to be raised
0f20f5
    because there were no tests to be run.
0f20f5
    
0f20f5
    License: MIT
0f20f5
    Signed-off-by: John Dennis <jdennis@redhat.com>
0f20f5
0f20f5
diff --git a/bindings/python/tests/profiles_tests.py b/bindings/python/tests/profiles_tests.py
0f20f5
index 547c9e24..0ba1e56e 100755
0f20f5
--- a/bindings/python/tests/profiles_tests.py
0f20f5
+++ b/bindings/python/tests/profiles_tests.py
0f20f5
@@ -386,6 +386,21 @@ class LogoutTestCase(unittest.TestCase):
0f20f5
         else:
0f20f5
             self.fail('Logout processResponseMsg should have failed.')
0f20f5
 
0f20f5
+    def test05(self):
0f20f5
+        '''Test parsing of a logout request with more than one session index'''
0f20f5
+        content = '''<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="xxxx" Version="2.0" IssueInstant="2010-06-14T22:00:00">
0f20f5
+        <saml:Issuer>me</saml:Issuer>
0f20f5
+        <saml:NameID>coin</saml:NameID>
0f20f5
+        <samlp:SessionIndex>id1</samlp:SessionIndex>
0f20f5
+        <samlp:SessionIndex>id2</samlp:SessionIndex>
0f20f5
+        <samlp:SessionIndex>id3</samlp:SessionIndex>
0f20f5
+        </samlp:LogoutRequest>'''
0f20f5
+
0f20f5
+        node = lasso.Samlp2LogoutRequest.newFromXmlNode(content)
0f20f5
+        assert isinstance(node, lasso.Samlp2LogoutRequest)
0f20f5
+        assert node.sessionIndex == 'id1'
0f20f5
+        assert node.sessionIndexes == ('id1', 'id2', 'id3')
0f20f5
+
0f20f5
 class DefederationTestCase(unittest.TestCase):
0f20f5
     def test01(self):
0f20f5
         """IDP initiated defederation; testing processNotificationMsg with non Liberty query."""
0f20f5
@@ -478,32 +493,15 @@ class AttributeAuthorityTestCase(unittest.TestCase):
0f20f5
         assert aq.response.assertion[0].attributeStatement[0].attribute[0]
0f20f5
         assert aq.response.assertion[0].attributeStatement[0].attribute[0].attributeValue[0]
0f20f5
 
0f20f5
-class LogoutTestCase(unittest.TestCase):
0f20f5
-    def test01(self):
0f20f5
-        '''Test parsing of a logout request with more than one session index'''
0f20f5
-        content = '''<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="xxxx" Version="2.0" IssueInstant="2010-06-14T22:00:00">
0f20f5
-        <saml:Issuer>me</saml:Issuer>
0f20f5
-        <saml:NameID>coin</saml:NameID>
0f20f5
-        <samlp:SessionIndex>id1</samlp:SessionIndex>
0f20f5
-        <samlp:SessionIndex>id2</samlp:SessionIndex>
0f20f5
-        <samlp:SessionIndex>id3</samlp:SessionIndex>
0f20f5
-        </samlp:LogoutRequest>'''
0f20f5
-
0f20f5
-        node = lasso.Samlp2LogoutRequest.newFromXmlNode(content)
0f20f5
-        assert isinstance(node, lasso.Samlp2LogoutRequest)
0f20f5
-        assert node.sessionIndex == 'id1'
0f20f5
-        assert node.sessionIndexes == ('id1', 'id2', 'id3')
0f20f5
-
0f20f5
 serverSuite = unittest.makeSuite(ServerTestCase, 'test')
0f20f5
 loginSuite = unittest.makeSuite(LoginTestCase, 'test')
0f20f5
 logoutSuite = unittest.makeSuite(LogoutTestCase, 'test')
0f20f5
 defederationSuite = unittest.makeSuite(DefederationTestCase, 'test')
0f20f5
 identitySuite = unittest.makeSuite(IdentityTestCase, 'test')
0f20f5
 attributeSuite = unittest.makeSuite(AttributeAuthorityTestCase, 'test')
0f20f5
-logoutSuite = unittest.makeSuite(LogoutTestCase, 'test')
0f20f5
 
0f20f5
 allTests = unittest.TestSuite((serverSuite, loginSuite, logoutSuite, defederationSuite,
0f20f5
-                               identitySuite, attributeSuite, logoutSuite))
0f20f5
+                               identitySuite, attributeSuite))
0f20f5
 
0f20f5
 if __name__ == '__main__':
0f20f5
     sys.exit(not unittest.TextTestRunner(verbosity = 2).run(allTests).wasSuccessful())