Skip to content

Commit a754bae

Browse files
committed
chore: Adjust tests to default namespace prefix
tests/test_88_nsprefix.py: Adjust "ns0" to namespace prefix "samlp" tests/test_02_saml.py: Use different prefix than the default one. tests/test_42_enc.py: The order of the namespace arguments in the string representation has changed (sorted alphabetical) Fix #326
1 parent 856348e commit a754bae

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

tests/test_02_saml.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,13 @@ def test_make_vals_multi_dict(self):
225225
def test_to_string_nspair(self):
226226
foo = saml2.make_vals("lions", AttributeValue, part=True)
227227
txt = foo.to_string().decode('utf-8')
228-
nsstr = foo.to_string({"saml": saml.NAMESPACE}).decode('utf-8')
228+
nsstr = foo.to_string({"saml2": saml.NAMESPACE}).decode('utf-8')
229229
assert nsstr != txt
230230
print(txt)
231231
print(nsstr)
232-
assert "saml:AttributeValue" in nsstr
233-
assert "saml:AttributeValue" not in txt
232+
assert "saml2:AttributeValue" in nsstr
233+
assert "saml2:AttributeValue" not in txt
234+
assert "saml:AttributeValue" in txt
234235

235236
def test_set_text_empty(self):
236237
av = AttributeValue()

tests/test_42_enc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,6 @@ def test_enc2():
134134

135135
assert enc_resp
136136

137+
137138
if __name__ == "__main__":
138139
test_enc1()

tests/test_88_nsprefix.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_nsprefix():
1313

1414
txt = "%s" % status_message
1515

16-
assert "ns0:StatusMessage" in txt
16+
assert "samlp:StatusMessage" in txt
1717

1818
status_message.register_prefix({"saml2": saml.NAMESPACE,
1919
"saml2p": samlp.NAMESPACE})
@@ -41,5 +41,6 @@ def test_nsprefix2():
4141
assert "saml2p:AuthnRequest" in txt
4242
assert "saml2:Issuer" in txt
4343

44+
4445
if __name__ == "__main__":
45-
test_nsprefix2()
46+
test_nsprefix2()

0 commit comments

Comments
 (0)