Browse Source

use strict datetime value in schema

Guénaël Muller 6 years ago
parent
commit
20ab0eaa42
2 changed files with 8 additions and 3 deletions
  1. 6 1
      tracim/tests/functional/test_session.py
  2. 2 2
      tracim/views/core_api/schemas.py

+ 6 - 1
tracim/tests/functional/test_session.py View File

@@ -1,4 +1,5 @@
1 1
 # coding=utf-8
2
+import datetime
2 3
 import pytest
3 4
 from sqlalchemy.exc import OperationalError
4 5
 
@@ -45,9 +46,13 @@ class TestLoginEndpoint(FunctionalTest):
45 46
             params=params,
46 47
             status=200,
47 48
         )
49
+        assert res.json_body['created']
50
+        datetime.datetime.strptime(
51
+            res.json_body['created'],
52
+            '%Y-%m-%dT%H:%M:%SZ'
53
+        )
48 54
         assert res.json_body['public_name'] == 'Global manager'
49 55
         assert res.json_body['email'] == 'admin@admin.admin'
50
-        assert res.json_body['created']
51 56
         assert res.json_body['is_active']
52 57
         assert res.json_body['profile']
53 58
         assert res.json_body['profile'] == 'administrators'

+ 2 - 2
tracim/views/core_api/schemas.py View File

@@ -27,8 +27,8 @@ class UserSchema(marshmallow.Schema):
27 27
         example='Suri Cate',
28 28
     )
29 29
     created = marshmallow.fields.DateTime(
30
-        format='iso8601',
31
-        description='User account creation date (iso8601 format).',
30
+        format='%Y-%m-%dT%H:%M:%SZ',
31
+        description='User account creation date',
32 32
     )
33 33
     is_active = marshmallow.fields.Bool(
34 34
         example=True,