synapse 2.205.0__py311-none-any.whl → 2.206.0__py311-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of synapse might be problematic. Click here for more details.

@@ -1,4 +1,5 @@
1
1
  import os
2
+ import http
2
3
  import asyncio
3
4
 
4
5
  from unittest import mock
@@ -304,6 +305,7 @@ class AhaTest(s_test.SynTest):
304
305
 
305
306
  async with self.getHttpSess(auth=('root', 'secret'), port=httpsport) as sess:
306
307
  async with sess.get(svcsurl) as resp:
308
+ self.eq(resp.status, http.HTTPStatus.OK)
307
309
  info = await resp.json()
308
310
  self.eq(info.get('status'), 'ok')
309
311
  result = info.get('result')
@@ -312,6 +314,7 @@ class AhaTest(s_test.SynTest):
312
314
  {svcinfo.get('name') for svcinfo in result})
313
315
 
314
316
  async with sess.get(svcsurl, json={'network': 'synapse'}) as resp:
317
+ self.eq(resp.status, http.HTTPStatus.OK)
315
318
  info = await resp.json()
316
319
  self.eq(info.get('status'), 'ok')
317
320
  result = info.get('result')
@@ -320,6 +323,7 @@ class AhaTest(s_test.SynTest):
320
323
  {svcinfo.get('name') for svcinfo in result})
321
324
 
322
325
  async with sess.get(svcsurl, json={'network': 'newp'}) as resp:
326
+ self.eq(resp.status, http.HTTPStatus.OK)
323
327
  info = await resp.json()
324
328
  self.eq(info.get('status'), 'ok')
325
329
  result = info.get('result')
@@ -327,11 +331,13 @@ class AhaTest(s_test.SynTest):
327
331
 
328
332
  # Sad path
329
333
  async with sess.get(svcsurl, json={'newp': 'hehe'}) as resp:
334
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
330
335
  info = await resp.json()
331
336
  self.eq(info.get('status'), 'err')
332
337
  self.eq(info.get('code'), 'SchemaViolation')
333
338
 
334
339
  async with sess.get(svcsurl, json={'network': 'mynet', 'newp': 'hehe'}) as resp:
340
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
335
341
  info = await resp.json()
336
342
  self.eq(info.get('status'), 'err')
337
343
  self.eq(info.get('code'), 'SchemaViolation')
@@ -339,6 +345,7 @@ class AhaTest(s_test.SynTest):
339
345
  # Sad path
340
346
  async with self.getHttpSess(auth=('lowuser', 'lowuser'), port=httpsport) as sess:
341
347
  async with sess.get(svcsurl) as resp:
348
+ self.eq(resp.status, http.HTTPStatus.FORBIDDEN)
342
349
  info = await resp.json()
343
350
  self.eq(info.get('status'), 'err')
344
351
  self.eq(info.get('code'), 'AuthDeny')
@@ -877,6 +884,7 @@ class AhaTest(s_test.SynTest):
877
884
  async with self.getHttpSess(auth=('root', 'secret'), port=httpsport) as sess:
878
885
  # Simple request works
879
886
  async with sess.post(url, json={'name': '00.foosvc'}) as resp:
887
+ self.eq(resp.status, http.HTTPStatus.OK)
880
888
  info = await resp.json()
881
889
  self.eq(info.get('status'), 'ok')
882
890
  result = info.get('result')
@@ -904,6 +912,7 @@ class AhaTest(s_test.SynTest):
904
912
  }
905
913
  }
906
914
  async with sess.post(url, json=data) as resp:
915
+ self.eq(resp.status, http.HTTPStatus.OK)
907
916
  info = await resp.json()
908
917
  self.eq(info.get('status'), 'ok')
909
918
  result = info.get('result')
@@ -919,30 +928,37 @@ class AhaTest(s_test.SynTest):
919
928
 
920
929
  # Sad path
921
930
  async with sess.post(url) as resp:
931
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
922
932
  info = await resp.json()
923
933
  self.eq(info.get('status'), 'err')
924
934
  self.eq(info.get('code'), 'SchemaViolation')
925
935
  async with sess.post(url, json={}) as resp:
936
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
926
937
  info = await resp.json()
927
938
  self.eq(info.get('status'), 'err')
928
939
  self.eq(info.get('code'), 'SchemaViolation')
929
940
  async with sess.post(url, json={'name': 1234}) as resp:
941
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
930
942
  info = await resp.json()
931
943
  self.eq(info.get('status'), 'err')
932
944
  self.eq(info.get('code'), 'SchemaViolation')
933
945
  async with sess.post(url, json={'name': ''}) as resp:
946
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
934
947
  info = await resp.json()
935
948
  self.eq(info.get('status'), 'err')
936
949
  self.eq(info.get('code'), 'SchemaViolation')
937
950
  async with sess.post(url, json={'name': '00.newp', 'provinfo': 5309}) as resp:
951
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
938
952
  info = await resp.json()
939
953
  self.eq(info.get('status'), 'err')
940
954
  self.eq(info.get('code'), 'SchemaViolation')
941
955
  async with sess.post(url, json={'name': '00.newp', 'provinfo': {'dmon:port': -1}}) as resp:
956
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
942
957
  info = await resp.json()
943
958
  self.eq(info.get('status'), 'err')
944
959
  self.eq(info.get('code'), 'SchemaViolation')
945
960
  async with sess.post(url, json={'name': 'doom' * 16}) as resp:
961
+ self.eq(resp.status, http.HTTPStatus.BAD_REQUEST)
946
962
  info = await resp.json()
947
963
  self.eq(info.get('status'), 'err')
948
964
  self.eq(info.get('code'), 'BadArg')
@@ -951,6 +967,7 @@ class AhaTest(s_test.SynTest):
951
967
  await aha.addUser('lowuser', passwd='lowuser')
952
968
  async with self.getHttpSess(auth=('lowuser', 'lowuser'), port=httpsport) as sess:
953
969
  async with sess.post(url, json={'name': '00.newp'}) as resp:
970
+ self.eq(resp.status, http.HTTPStatus.FORBIDDEN)
954
971
  info = await resp.json()
955
972
  self.eq(info.get('status'), 'err')
956
973
  self.eq(info.get('code'), 'AuthDeny')
@@ -1,3 +1,4 @@
1
+ import http
1
2
  import os
2
3
  import ssl
3
4
  import sys
@@ -2923,7 +2924,7 @@ class CellTest(s_t_utils.SynTest):
2923
2924
  headers2 = {'X-API-KEY': rtk1}
2924
2925
  resp = await sess.post(f'https://localhost:{hport}/api/v1/auth/onepass/issue', headers=headers2,
2925
2926
  json={'user': lowuser})
2926
- self.eq(401, resp.status)
2927
+ self.eq(resp.status, http.HTTPStatus.UNAUTHORIZED)
2927
2928
  answ = await resp.json()
2928
2929
  self.eq('err', answ['status'])
2929
2930
 
@@ -2945,7 +2946,7 @@ class CellTest(s_t_utils.SynTest):
2945
2946
 
2946
2947
  resp = await sess.post(f'https://localhost:{hport}/api/v1/auth/onepass/issue', headers=headers2,
2947
2948
  json={'user': lowuser})
2948
- self.eq(401, resp.status)
2949
+ self.eq(resp.status, http.HTTPStatus.UNAUTHORIZED)
2949
2950
  answ = await resp.json()
2950
2951
  self.eq('err', answ['status'])
2951
2952
 
@@ -2985,13 +2986,14 @@ class CellTest(s_t_utils.SynTest):
2985
2986
  await cell.setUserLocked(lowuser, True)
2986
2987
  resp = await sess.post(f'https://localhost:{hport}/api/v1/auth/password/{lowuser}', headers=headers2,
2987
2988
  json={'passwd': 'secret'})
2988
- self.eq(401, resp.status)
2989
+ self.eq(resp.status, http.HTTPStatus.UNAUTHORIZED)
2989
2990
  answ = await resp.json()
2990
2991
  self.eq('err', answ['status'])
2991
2992
 
2992
2993
  await cell.delUser(lowuser)
2993
2994
  resp = await sess.post(f'https://localhost:{hport}/api/v1/auth/password/{lowuser}', headers=headers2,
2994
2995
  json={'passwd': 'secret'})
2996
+ self.eq(resp.status, http.HTTPStatus.UNAUTHORIZED)
2995
2997
  answ = await resp.json()
2996
2998
  self.eq('err', answ['status'])
2997
2999