Skip to content

Commit

Permalink
Try to fix dates
Browse files Browse the repository at this point in the history
  • Loading branch information
avdata99 committed Jul 31, 2024
1 parent d06e7b3 commit c808afd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ckanext/saml2auth/tests/test_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_cookies_cleared_on_slo(self, app):
assert cookie_name in ['auth_tkt', 'ckan']
assert cookie[cookie_name]['domain'] == 'test.ckan.net'
cookie_date = date_parse(cookie[cookie_name]['expires'], ignoretz=True)
assert cookie_date < datetime.datetime.now()
assert cookie_date < datetime.datetime.now(datetime.UTC)

@pytest.mark.ckan_config(u'ckanext.saml2auth.idp_metadata.location', u'local')
@pytest.mark.ckan_config(u'ckanext.saml2auth.idp_metadata.local_path',
Expand Down Expand Up @@ -135,4 +135,4 @@ def test_ckan_cookie_cleared_on_slo(self, app):
assert cookie_name == 'ckan'
assert cookie[cookie_name]['domain'] == 'test.ckan.net'
cookie_date = date_parse(cookie[cookie_name]['expires'], ignoretz=True)
assert cookie_date < datetime.datetime.now()
assert cookie_date < datetime.datetime.now(datetime.UTC)
3 changes: 2 additions & 1 deletion ckanext/saml2auth/tests/test_blueprint_get_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _prepare_unsigned_response():
'entity_id': 'urn:gov:gsa:SAML:2.0.profiles:sp:sso:test:entity',
'destination': 'http://test.ckan.net/acs',
'recipient': 'http://test.ckan.net/acs',
'issue_instant': datetime.now().isoformat()
'issue_instant': datetime.now(datetime.UTC).isoformat(),
}
t = Template(unsigned_response)
final_response = t.render(**context)
Expand Down Expand Up @@ -120,6 +120,7 @@ def test_unsigned_request(self, app):
response = app.post(url=url, params=data)
if response.status_code != 200:
assert False, f'Failed test_unsigned_request: {response.body}'
# Can&#39;t use response, too old (now=2024-07-31T17:42:38Z + slack=0 &gt; not_on_or_after=2024-01-18T06:21:48Z
assert 200 == response.status_code

def render_file(self, path, context, save_as=None):
Expand Down

0 comments on commit c808afd

Please sign in to comment.