Refactored class methods

This commit is contained in:
Roland Hedberg
2014-03-08 19:41:19 +01:00
parent 7b41b464c5
commit b63a810fa5
3 changed files with 20 additions and 9 deletions

View File

@@ -193,7 +193,7 @@ def test_filter_attribute_value_assertions_0(AVA):
}) })
ava = filter_attribute_value_assertions(AVA[3].copy(), ava = filter_attribute_value_assertions(AVA[3].copy(),
p.get_attribute_restriction("")) p.get_attribute_restrictions(""))
print ava print ava
assert ava.keys() == ["surName"] assert ava.keys() == ["surName"]
@@ -211,7 +211,7 @@ def test_filter_attribute_value_assertions_1(AVA):
}) })
ava = filter_attribute_value_assertions(AVA[0].copy(), ava = filter_attribute_value_assertions(AVA[0].copy(),
p.get_attribute_restriction("")) p.get_attribute_restrictions(""))
print ava print ava
assert _eq(ava.keys(), ["givenName", "surName"]) assert _eq(ava.keys(), ["givenName", "surName"])
@@ -219,7 +219,7 @@ def test_filter_attribute_value_assertions_1(AVA):
assert ava["givenName"] == ["Derek"] assert ava["givenName"] == ["Derek"]
ava = filter_attribute_value_assertions(AVA[1].copy(), ava = filter_attribute_value_assertions(AVA[1].copy(),
p.get_attribute_restriction("")) p.get_attribute_restrictions(""))
print ava print ava
assert _eq(ava.keys(), ["surName"]) assert _eq(ava.keys(), ["surName"])
@@ -236,20 +236,20 @@ def test_filter_attribute_value_assertions_2(AVA):
}) })
ava = filter_attribute_value_assertions(AVA[0].copy(), ava = filter_attribute_value_assertions(AVA[0].copy(),
p.get_attribute_restriction("")) p.get_attribute_restrictions(""))
print ava print ava
assert _eq(ava.keys(), []) assert _eq(ava.keys(), [])
ava = filter_attribute_value_assertions(AVA[1].copy(), ava = filter_attribute_value_assertions(AVA[1].copy(),
p.get_attribute_restriction("")) p.get_attribute_restrictions(""))
print ava print ava
assert _eq(ava.keys(), ["givenName"]) assert _eq(ava.keys(), ["givenName"])
assert ava["givenName"] == ["Ryan"] assert ava["givenName"] == ["Ryan"]
ava = filter_attribute_value_assertions(AVA[3].copy(), ava = filter_attribute_value_assertions(AVA[3].copy(),
p.get_attribute_restriction("")) p.get_attribute_restrictions(""))
print ava print ava
assert _eq(ava.keys(), ["givenName"]) assert _eq(ava.keys(), ["givenName"])
@@ -797,4 +797,4 @@ def test_assertion_with_authn_instant():
if __name__ == "__main__": if __name__ == "__main__":
test_assertion_with_authn_instant() test_assertion_2()

View File

@@ -238,7 +238,7 @@ def test_idp_1():
assert c.endpoint("single_sign_on_service")[0] == 'http://localhost:8088/' assert c.endpoint("single_sign_on_service")[0] == 'http://localhost:8088/'
attribute_restrictions = c.getattr("policy", attribute_restrictions = c.getattr("policy",
"idp").get_attribute_restriction("") "idp").get_attribute_restrictions("")
assert attribute_restrictions["edupersonaffiliation"][0].match("staff") assert attribute_restrictions["edupersonaffiliation"][0].match("staff")
@@ -253,7 +253,7 @@ def test_idp_2():
BINDING_HTTP_REDIRECT) == ["http://localhost:8088/"] BINDING_HTTP_REDIRECT) == ["http://localhost:8088/"]
attribute_restrictions = c.getattr("policy", attribute_restrictions = c.getattr("policy",
"idp").get_attribute_restriction("") "idp").get_attribute_restrictions("")
assert attribute_restrictions["edupersonaffiliation"][0].match("staff") assert attribute_restrictions["edupersonaffiliation"][0].match("staff")

View File

@@ -83,6 +83,7 @@ def test_cert_from_instance_ssp():
print str(decoder.decode(der)).replace('.', "\n.") print str(decoder.decode(der)).replace('.', "\n.")
assert decoder.decode(der) assert decoder.decode(der)
class FakeConfig(): class FakeConfig():
""" """
Configuration parameters for signature validation test cases. Configuration parameters for signature validation test cases.
@@ -94,6 +95,12 @@ class FakeConfig():
cert_file = PUB_KEY cert_file = PUB_KEY
key_file = PRIV_KEY key_file = PRIV_KEY
debug = False debug = False
cert_handler_extra_class = None
generate_cert_info = False
tmp_cert_file = None
tmp_key_file = None
validate_certificate = False
class TestSecurity(): class TestSecurity():
@@ -418,3 +425,7 @@ class TestSecurityMetadata():
item = self.sec.check_signature(sass, class_name(sass), sign_ass) item = self.sec.check_signature(sass, class_name(sass), sign_ass)
assert isinstance(item, saml.Assertion) assert isinstance(item, saml.Assertion)
if __name__ == "__main__":
t = TestSecurity()
t.setup_class()