summaryrefslogtreecommitdiff
path: root/src/saml2/ecp_client.py
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2020-09-11 02:28:49 +0300
committerGitHub <noreply@github.com>2020-09-11 02:28:49 +0300
commit9f0de5891b1ca6830dfde44b1a13ee4e7585fe8c (patch)
tree543f78595d25fd3127199e26917df9b3c67c156b /src/saml2/ecp_client.py
parent1aeae3ae565e02f863a26b2893354d048a7abff8 (diff)
parentbc96c3856dfd6ffbd27e0f59acacfef2b71e4edd (diff)
downloadpysaml2-9f0de5891b1ca6830dfde44b1a13ee4e7585fe8c.tar.gz
Merge pull request #716 from IdentityPython/assert_deletion
Replace assert statements
Diffstat (limited to 'src/saml2/ecp_client.py')
-rw-r--r--src/saml2/ecp_client.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/saml2/ecp_client.py b/src/saml2/ecp_client.py
index f0183f45..5265f99d 100644
--- a/src/saml2/ecp_client.py
+++ b/src/saml2/ecp_client.py
@@ -136,7 +136,14 @@ class Client(Entity):
logger.debug("[P2] IdP response dict: %s", respdict)
idp_response = respdict["body"]
- assert idp_response.c_tag == "Response"
+
+ expected_tag = "Response"
+ if idp_response.c_tag != expected_tag:
+ raise ValueError(
+ "Invalid Response tag '{invalid}' should be '{valid}'".format(
+ invalid=idp_response.c_tag, valid=expected_tag
+ )
+ )
logger.debug("[P2] IdP AUTHN response: %s", idp_response)
@@ -165,7 +172,14 @@ class Client(Entity):
# AuthnRequest in the body or not
authn_request = respdict["body"]
- assert authn_request.c_tag == "AuthnRequest"
+
+ expected_tag = "AuthnRequest"
+ if authn_request.c_tag != expected_tag:
+ raise ValueError(
+ "Invalid AuthnRequest tag '{invalid}' should be '{valid}'".format(
+ invalid=authn_request.c_tag, valid=expected_tag
+ )
+ )
# ecp.RelayState among headers
_relay_state = None