Bladeren bron

use strict datetime value in schema

Guénaël Muller 6 jaren geleden
bovenliggende
commit
20ab0eaa42
2 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  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 Bestand weergeven

1
 # coding=utf-8
1
 # coding=utf-8
2
+import datetime
2
 import pytest
3
 import pytest
3
 from sqlalchemy.exc import OperationalError
4
 from sqlalchemy.exc import OperationalError
4
 
5
 
45
             params=params,
46
             params=params,
46
             status=200,
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
         assert res.json_body['public_name'] == 'Global manager'
54
         assert res.json_body['public_name'] == 'Global manager'
49
         assert res.json_body['email'] == 'admin@admin.admin'
55
         assert res.json_body['email'] == 'admin@admin.admin'
50
-        assert res.json_body['created']
51
         assert res.json_body['is_active']
56
         assert res.json_body['is_active']
52
         assert res.json_body['profile']
57
         assert res.json_body['profile']
53
         assert res.json_body['profile'] == 'administrators'
58
         assert res.json_body['profile'] == 'administrators'

+ 2 - 2
tracim/views/core_api/schemas.py Bestand weergeven

27
         example='Suri Cate',
27
         example='Suri Cate',
28
     )
28
     )
29
     created = marshmallow.fields.DateTime(
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
     is_active = marshmallow.fields.Bool(
33
     is_active = marshmallow.fields.Bool(
34
         example=True,
34
         example=True,