1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 14:34:19 +00:00

Aggiunti test per luogo, data e un filtro combinato

This commit is contained in:
Annielated 2021-05-02 23:56:29 +02:00
parent 1607206d05
commit f06b9cdb61

View file

@ -27,6 +27,7 @@ class MyTestCase(unittest.TestCase):
assert j['result'] == "success"
auth_code = j['data']['access_token']
# uso come filtro un hashtag
r = requests.post(f'http://localhost:5000/api/v1/repositories/16/conditions',
headers={'authorization': "Bearer " + auth_code},
json={'type': 0, 'content': 'MarioDraghi'})
@ -34,6 +35,30 @@ class MyTestCase(unittest.TestCase):
assert j['result'] == "success"
print("Conditions dei Repositories creati correttamente!")
# uso come filtro un luogo
r = requests.post(f'http://localhost:5000/api/v1/repositories/16/conditions',
headers={'authorization': "Bearer " + auth_code},
json={'type': 1, 'content': 'Roma'})
j = json.loads(r.text)
assert j['result'] == "success"
print("Conditions dei Repositories creati correttamente!")
# uso come filtro una data
r = requests.post(f'http://localhost:5000/api/v1/repositories/16/conditions',
headers={'authorization': "Bearer " + auth_code},
json={'type': 2, 'content': '26/06/2021'})
j = json.loads(r.text)
assert j['result'] == "success"
print("Conditions dei Repositories creati correttamente!")
# uso una combinazione di filtri
r = requests.post(f'http://localhost:5000/api/v1/repositories/16/conditions',
headers={'authorization': "Bearer " + auth_code},
json={'type': 1 and 0, 'content': 'Roma' and 'Totti'})
j = json.loads(r.text)
assert j['result'] == "success"
print("Conditions dei Repositories creati correttamente!")
if __name__ == '__main__':
unittest.main()