Skip to content

Commit 409d025

Browse files
authored
BB2-3483: Fixed date format (#1265)
* Fixed date format * Fixed merge issues
1 parent aecfe03 commit 409d025

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

apps/dot_ext/tests/test_authorization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def test_dag_expiration_exists(self):
575575
c = Client()
576576
response = c.post('/v1/o/token/', data=token_request_data)
577577
tkn = response.json()
578-
expiration_date_string = strftime('%Y-%m-%d %H:%M:%SZ', expiration_date.timetuple())
578+
expiration_date_string = strftime('%Y-%m-%dT%H:%M:%SZ', expiration_date.timetuple())
579579
self.assertEqual(tkn["access_grant_expiration"][:-4], expiration_date_string[:-4])
580580

581581
def test_revoke_endpoint(self):

apps/dot_ext/views/authorization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ def post(self, request, *args, **kwargs):
321321
app_authorized.send(
322322
sender=self, request=request,
323323
token=token)
324+
324325
flag = get_waffle_flag_model().get("limit_data_access")
325326
if flag.rollout or (flag.id is not None and flag.is_active_for_user(app.user)):
326327
if app.data_access_type == "THIRTEEN_MONTH":
@@ -330,13 +331,13 @@ def post(self, request, *args, **kwargs):
330331
application=app
331332
)
332333
if dag.expiration_date is not None:
333-
dag_expiry = strftime('%Y-%m-%d %H:%M:%SZ', dag.expiration_date.timetuple())
334+
dag_expiry = strftime('%Y-%m-%dT%H:%M:%SZ', dag.expiration_date.timetuple())
334335
except DataAccessGrant.DoesNotExist:
335336
dag_expiry = ""
336337

337338
elif app.data_access_type == "ONE_TIME":
338339
expires_at = datetime.utcnow() + timedelta(seconds=body['expires_in'])
339-
dag_expiry = expires_at.strftime('%Y-%m-%d %H:%M:%SZ')
340+
dag_expiry = expires_at.strftime('%Y-%m-%dT%H:%M:%SZ')
340341
elif app.data_access_type == "RESEARCH_STUDY":
341342
dag_expiry = ""
342343

0 commit comments

Comments
 (0)