Skip to content

Commit d6b6204

Browse files
committed
Fix 1 unit test
1 parent ac56076 commit d6b6204

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

onelogin/saml/test/TestResponse.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,11 @@ def test_is_valid_not_before_missing(self):
283283
<saml:SubjectConfirmationData
284284
InResponseTo="identifier_1"
285285
Recipient="https://sp.example.com/SAML2/SSO/POST"
286-
NotOnOrAfter="2004-12-05T09:27:05Z"/>
286+
NotOnOrAfter="2024-12-05T09:27:05Z"/>
287287
</saml:SubjectConfirmation>
288288
</saml:Subject>
289289
<saml:Conditions
290-
NotOnOrAfter="2004-12-05T09:27:05Z">
290+
NotOnOrAfter="2024-12-05T09:27:05Z">
291291
<saml:AudienceRestriction>
292292
<saml:Audience>https://sp.example.com/SAML2</saml:Audience>
293293
</saml:AudienceRestriction>
@@ -307,18 +307,23 @@ def test_is_valid_not_before_missing(self):
307307
encoded_response = base64.b64encode(response)
308308
res = Response(
309309
response=encoded_response,
310-
signature=None,
310+
signature='foo signature',
311311
)
312-
msg = assert_raises(
313-
ResponseConditionError,
314-
res.is_valid,
312+
313+
fake_verifier = fudge.Fake(
314+
'verifier',
315+
callable=True,
315316
)
317+
fake_verifier.times_called(1)
318+
fake_verifier.with_args(res._document, 'foo signature')
316319

317-
eq(str(msg),
318-
('There was a problem validating a condition: Did not find NotBefore '
319-
+ 'condition'
320-
),
321-
)
320+
fake_verifier.returns(True)
321+
322+
msg = res.is_valid(
323+
_verifier=fake_verifier,
324+
)
325+
326+
eq(msg, True)
322327

323328
@fudge.with_fakes
324329
def test_is_valid_not_on_or_after_missing(self):

0 commit comments

Comments
 (0)