@@ -122,7 +122,7 @@ def test_user_is_not_local(self, method: str) -> None:
122
122
123
123
def test_unknown_device (self ) -> None :
124
124
"""
125
- Tests that a lookup for a device that does not exist returns either HTTPStatus.NOT_FOUND or HTTPStatus.OK .
125
+ Tests that a lookup for a device that does not exist returns either HTTPStatus.NOT_FOUND or 200 .
126
126
"""
127
127
url = "/_synapse/admin/v2/users/%s/devices/unknown_device" % urllib .parse .quote (
128
128
self .other_user
@@ -143,16 +143,16 @@ def test_unknown_device(self) -> None:
143
143
access_token = self .admin_user_tok ,
144
144
)
145
145
146
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
146
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
147
147
148
148
channel = self .make_request (
149
149
"DELETE" ,
150
150
url ,
151
151
access_token = self .admin_user_tok ,
152
152
)
153
153
154
- # Delete unknown device returns status HTTPStatus.OK
155
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
154
+ # Delete unknown device returns status 200
155
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
156
156
157
157
def test_update_device_too_long_display_name (self ) -> None :
158
158
"""
@@ -189,12 +189,12 @@ def test_update_device_too_long_display_name(self) -> None:
189
189
access_token = self .admin_user_tok ,
190
190
)
191
191
192
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
192
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
193
193
self .assertEqual ("new display" , channel .json_body ["display_name" ])
194
194
195
195
def test_update_no_display_name (self ) -> None :
196
196
"""
197
- Tests that a update for a device without JSON returns a HTTPStatus.OK
197
+ Tests that a update for a device without JSON returns a 200
198
198
"""
199
199
# Set iniital display name.
200
200
update = {"display_name" : "new display" }
@@ -210,7 +210,7 @@ def test_update_no_display_name(self) -> None:
210
210
access_token = self .admin_user_tok ,
211
211
)
212
212
213
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
213
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
214
214
215
215
# Ensure the display name was not updated.
216
216
channel = self .make_request (
@@ -219,7 +219,7 @@ def test_update_no_display_name(self) -> None:
219
219
access_token = self .admin_user_tok ,
220
220
)
221
221
222
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
222
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
223
223
self .assertEqual ("new display" , channel .json_body ["display_name" ])
224
224
225
225
def test_update_display_name (self ) -> None :
@@ -234,7 +234,7 @@ def test_update_display_name(self) -> None:
234
234
content = {"display_name" : "new displayname" },
235
235
)
236
236
237
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
237
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
238
238
239
239
# Check new display_name
240
240
channel = self .make_request (
@@ -243,7 +243,7 @@ def test_update_display_name(self) -> None:
243
243
access_token = self .admin_user_tok ,
244
244
)
245
245
246
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
246
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
247
247
self .assertEqual ("new displayname" , channel .json_body ["display_name" ])
248
248
249
249
def test_get_device (self ) -> None :
@@ -256,7 +256,7 @@ def test_get_device(self) -> None:
256
256
access_token = self .admin_user_tok ,
257
257
)
258
258
259
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
259
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
260
260
self .assertEqual (self .other_user , channel .json_body ["user_id" ])
261
261
# Check that all fields are available
262
262
self .assertIn ("user_id" , channel .json_body )
@@ -281,7 +281,7 @@ def test_delete_device(self) -> None:
281
281
access_token = self .admin_user_tok ,
282
282
)
283
283
284
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
284
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
285
285
286
286
# Ensure that the number of devices is decreased
287
287
res = self .get_success (self .handler .get_devices_by_user (self .other_user ))
@@ -379,7 +379,7 @@ def test_user_has_no_devices(self) -> None:
379
379
access_token = self .admin_user_tok ,
380
380
)
381
381
382
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
382
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
383
383
self .assertEqual (0 , channel .json_body ["total" ])
384
384
self .assertEqual (0 , len (channel .json_body ["devices" ]))
385
385
@@ -399,7 +399,7 @@ def test_get_devices(self) -> None:
399
399
access_token = self .admin_user_tok ,
400
400
)
401
401
402
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
402
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
403
403
self .assertEqual (number_devices , channel .json_body ["total" ])
404
404
self .assertEqual (number_devices , len (channel .json_body ["devices" ]))
405
405
self .assertEqual (self .other_user , channel .json_body ["devices" ][0 ]["user_id" ])
@@ -494,7 +494,7 @@ def test_user_is_not_local(self) -> None:
494
494
495
495
def test_unknown_devices (self ) -> None :
496
496
"""
497
- Tests that a remove of a device that does not exist returns HTTPStatus.OK .
497
+ Tests that a remove of a device that does not exist returns 200 .
498
498
"""
499
499
channel = self .make_request (
500
500
"POST" ,
@@ -503,8 +503,8 @@ def test_unknown_devices(self) -> None:
503
503
content = {"devices" : ["unknown_device1" , "unknown_device2" ]},
504
504
)
505
505
506
- # Delete unknown devices returns status HTTPStatus.OK
507
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
506
+ # Delete unknown devices returns status 200
507
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
508
508
509
509
def test_delete_devices (self ) -> None :
510
510
"""
@@ -533,7 +533,7 @@ def test_delete_devices(self) -> None:
533
533
content = {"devices" : device_ids },
534
534
)
535
535
536
- self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
536
+ self .assertEqual (200 , channel .code , msg = channel .json_body )
537
537
538
538
res = self .get_success (self .handler .get_devices_by_user (self .other_user ))
539
539
self .assertEqual (0 , len (res ))
0 commit comments