diff --git a/apps/dot_ext/tests/test_authorization.py b/apps/dot_ext/tests/test_authorization.py index e159074c1..c60fdf111 100644 --- a/apps/dot_ext/tests/test_authorization.py +++ b/apps/dot_ext/tests/test_authorization.py @@ -575,7 +575,7 @@ def test_dag_expiration_exists(self): c = Client() response = c.post('/v1/o/token/', data=token_request_data) tkn = response.json() - expiration_date_string = strftime('%Y-%m-%d %H:%M:%SZ', expiration_date.timetuple()) + expiration_date_string = strftime('%Y-%m-%dT%H:%M:%SZ', expiration_date.timetuple()) self.assertEqual(tkn["access_grant_expiration"][:-4], expiration_date_string[:-4]) def test_revoke_endpoint(self): diff --git a/apps/dot_ext/views/authorization.py b/apps/dot_ext/views/authorization.py index a75d06f26..847bd1a99 100644 --- a/apps/dot_ext/views/authorization.py +++ b/apps/dot_ext/views/authorization.py @@ -321,6 +321,7 @@ def post(self, request, *args, **kwargs): app_authorized.send( sender=self, request=request, token=token) + flag = get_waffle_flag_model().get("limit_data_access") if flag.rollout or (flag.id is not None and flag.is_active_for_user(app.user)): if app.data_access_type == "THIRTEEN_MONTH": @@ -330,13 +331,13 @@ def post(self, request, *args, **kwargs): application=app ) if dag.expiration_date is not None: - dag_expiry = strftime('%Y-%m-%d %H:%M:%SZ', dag.expiration_date.timetuple()) + dag_expiry = strftime('%Y-%m-%dT%H:%M:%SZ', dag.expiration_date.timetuple()) except DataAccessGrant.DoesNotExist: dag_expiry = "" elif app.data_access_type == "ONE_TIME": expires_at = datetime.utcnow() + timedelta(seconds=body['expires_in']) - dag_expiry = expires_at.strftime('%Y-%m-%d %H:%M:%SZ') + dag_expiry = expires_at.strftime('%Y-%m-%dT%H:%M:%SZ') elif app.data_access_type == "RESEARCH_STUDY": dag_expiry = ""