Browse Source

Update session-related schema

Guénaël Muller 6 years ago
parent
commit
e44df97e17
2 changed files with 7 additions and 3 deletions
  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 View File

66
         assert res.json_body['is_active']
66
         assert res.json_body['is_active']
67
         assert res.json_body['profile']
67
         assert res.json_body['profile']
68
         assert isinstance(res.json_body['profile']['id'], int)
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
     def test_unauthenticated(self):
71
     def test_unauthenticated(self):
72
         self.testapp.authorization = (
72
         self.testapp.authorization = (

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

4
 
4
 
5
 class ProfileSchema(marshmallow.Schema):
5
 class ProfileSchema(marshmallow.Schema):
6
     id = marshmallow.fields.Int(dump_only=True)
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
 class UserSchema(marshmallow.Schema):
10
 class UserSchema(marshmallow.Schema):
16
     # TODO - G.M - 17-04-2018 - Restrict timezone values
16
     # TODO - G.M - 17-04-2018 - Restrict timezone values
17
     timezone = marshmallow.fields.String()
17
     timezone = marshmallow.fields.String()
18
     # TODO - G.M - 17-04-2018 - check this, relative url allowed ?
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
     profile = marshmallow.fields.Nested(
24
     profile = marshmallow.fields.Nested(
21
         ProfileSchema,
25
         ProfileSchema,
22
         many=False,
26
         many=False,