Browse Source

rename display_name as public_name in endpoint

Guénaël Muller 6 years ago
parent
commit
144dafc9b3

+ 4 - 0
tracim/models/context_models.py View File

@@ -91,6 +91,10 @@ class UserInContext(object):
91 91
         return self.user.user_id
92 92
 
93 93
     @property
94
+    def public_name(self) -> str:
95
+        return self.display_name
96
+
97
+    @property
94 98
     def display_name(self) -> str:
95 99
         return self.user.display_name
96 100
 

+ 2 - 2
tracim/tests/functional/test_session.py View File

@@ -45,7 +45,7 @@ class TestLoginEndpoint(FunctionalTest):
45 45
             params=params,
46 46
             status=200,
47 47
         )
48
-        assert res.json_body['display_name'] == 'Global manager'
48
+        assert res.json_body['public_name'] == 'Global manager'
49 49
         assert res.json_body['email'] == 'admin@admin.admin'
50 50
         assert res.json_body['created']
51 51
         assert res.json_body['is_active']
@@ -103,7 +103,7 @@ class TestWhoamiEndpoint(FunctionalTest):
103 103
             )
104 104
         )
105 105
         res = self.testapp.get('/api/v2/sessions/whoami', status=200)
106
-        assert res.json_body['display_name'] == 'Global manager'
106
+        assert res.json_body['public_name'] == 'Global manager'
107 107
         assert res.json_body['email'] == 'admin@admin.admin'
108 108
         assert res.json_body['created']
109 109
         assert res.json_body['is_active']

+ 1 - 1
tracim/tests/functional/test_workspaces.py View File

@@ -158,7 +158,7 @@ class TestWorkspaceMembersEndpoint(FunctionalTest):
158 158
         assert user_role['role'] == 'workspace-manager'
159 159
         assert user_role['user_id'] == 1
160 160
         assert user_role['workspace_id'] == 1
161
-        assert user_role['user']['display_name'] == 'Global manager'
161
+        assert user_role['user']['public_name'] == 'Global manager'
162 162
         # TODO - G.M - 24-05-2018 - [Avatar] Replace
163 163
         # by correct value when avatar feature will be enabled
164 164
         assert user_role['user']['avatar_url'] is None

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

@@ -34,7 +34,7 @@ class UserSchema(marshmallow.Schema):
34 34
         required=True,
35 35
         example='suri.cate@algoo.fr'
36 36
     )
37
-    display_name = marshmallow.fields.String(
37
+    public_name = marshmallow.fields.String(
38 38
         example='Suri Cate',
39 39
     )
40 40
     created = marshmallow.fields.DateTime(
@@ -214,7 +214,7 @@ class WorkspaceMemberSchema(marshmallow.Schema):
214 214
     user_id = marshmallow.fields.Int(example=3)
215 215
     workspace_id = marshmallow.fields.Int(example=4)
216 216
     user = marshmallow.fields.Nested(
217
-        UserSchema(only=('display_name', 'avatar_url'))
217
+        UserSchema(only=('public_name', 'avatar_url'))
218 218
     )
219 219
 
220 220
     class Meta: