mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 13:04:19 +00:00
aggiunto test della richiesta patch
This commit is contained in:
parent
05ef878875
commit
a075ecbe88
1 changed files with 9 additions and 6 deletions
|
@ -8,21 +8,24 @@ class MyTestCase(unittest.TestCase):
|
||||||
global auth_code
|
global auth_code
|
||||||
|
|
||||||
# eseguo il login
|
# eseguo il login
|
||||||
r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'admin@admin.com', 'password': 'password'})
|
r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'utente_test@nest.com', 'password': 'password'})
|
||||||
j = json.loads(r.text)
|
j = json.loads(r.text)
|
||||||
assert j['result'] == "success"
|
assert j['result'] == "success"
|
||||||
auth_code = j['data']['access_token']
|
auth_code = j['data']['access_token']
|
||||||
|
|
||||||
# ritorno le info sulla repo speficicata dopo /repositories
|
'''# ritorno le info sulla repo speficicata dopo /repositories
|
||||||
r = requests.get(f'http://localhost:5000/api/v1/repositories/15', headers={'authorization': "Bearer " + auth_code})
|
r = requests.get(f'http://localhost:5000/api/v1/repositories/17', headers={'authorization': "Bearer " + auth_code})
|
||||||
j = json.loads(r.text)
|
j = json.loads(r.text)
|
||||||
assert j['result'] == "success"
|
assert j['result'] == "success"
|
||||||
|
|
||||||
r = requests.delete(f'http://localhost:5000/api/v1/repositories/15', headers={'authorization': "Bearer " + auth_code})
|
r = requests.delete(f'http://localhost:5000/api/v1/repositories/17', headers={'authorization': "Bearer " + auth_code})
|
||||||
j = json.loads(r.text)
|
j = json.loads(r.text)
|
||||||
assert j['result'] == 'success'
|
assert j['result'] == "success"'''
|
||||||
|
|
||||||
|
|
||||||
|
r = requests.patch(f'http://localhost:5000/api/v1/repositories/16', headers={'authorization': "Bearer " + auth_code},
|
||||||
|
json={'name': 'newname', 'open': True})
|
||||||
|
j = json.loads(r.text)
|
||||||
|
assert j['result'] == "success"
|
||||||
|
|
||||||
|
|
||||||
print('Testing del metodo repository_edit')
|
print('Testing del metodo repository_edit')
|
||||||
|
|
Loading…
Reference in a new issue