Преглед изворни кода

Update session-related schema

Guénaël Muller пре 6 година
родитељ
комит
e44df97e17
2 измењених фајлова са 7 додато и 3 уклоњено
  1. 1 1
      tracim/tests/functional/test_session.py
  2. 6 2
      tracim/views/core_api/schemas.py

+ 1 - 1
tracim/tests/functional/test_session.py Прегледај датотеку

@@ -66,7 +66,7 @@ class TestWhoamiEndpoint(FunctionalTest):
66 66
         assert res.json_body['is_active']
67 67
         assert res.json_body['profile']
68 68
         assert isinstance(res.json_body['profile']['id'], int)
69
-        assert res.json_body['profile']['name'] == 'administrators'
69
+        assert res.json_body['profile']['slug'] == 'administrators'
70 70
 
71 71
     def test_unauthenticated(self):
72 72
         self.testapp.authorization = (

+ 6 - 2
tracim/views/core_api/schemas.py Прегледај датотеку

@@ -4,7 +4,7 @@ import marshmallow
4 4
 
5 5
 class ProfileSchema(marshmallow.Schema):
6 6
     id = marshmallow.fields.Int(dump_only=True)
7
-    name = marshmallow.fields.String()
7
+    slug = marshmallow.fields.String(attribute='name')
8 8
 
9 9
 
10 10
 class UserSchema(marshmallow.Schema):
@@ -16,7 +16,11 @@ class UserSchema(marshmallow.Schema):
16 16
     # TODO - G.M - 17-04-2018 - Restrict timezone values
17 17
     timezone = marshmallow.fields.String()
18 18
     # TODO - G.M - 17-04-2018 - check this, relative url allowed ?
19
-    caldav_url = marshmallow.fields.Url(relative=True)
19
+    caldav_url = marshmallow.fields.Url(
20
+        relative=True,
21
+        attribute='calendar_url'
22
+    )
23
+    avatar_url = marshmallow.fields.Url()
20 24
     profile = marshmallow.fields.Nested(
21 25
         ProfileSchema,
22 26
         many=False,