mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 04:54:18 +00:00
le repository vengono create correttamente, servono però ulteriori controlli
This commit is contained in:
parent
90afbc7674
commit
b0b0038a7a
1 changed files with 27 additions and 0 deletions
27
code/backend/nest_backend/test/repository_create_test.py
Normal file
27
code/backend/nest_backend/test/repository_create_test.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
auth_code = ""
|
||||||
|
|
||||||
|
|
||||||
|
class MyTestCase(unittest.TestCase):
|
||||||
|
def test_repository_create(self):
|
||||||
|
global auth_code
|
||||||
|
|
||||||
|
r = requests.post('http://localhost:5000/api/login', json={'email': 'utente13@nest.com', 'password': ''})
|
||||||
|
j = json.loads(r.text)
|
||||||
|
assert j['result'] == "success"
|
||||||
|
auth_code = j['data']['access_token']
|
||||||
|
|
||||||
|
r = requests.post(f'http://localhost:5000/api/repository/create', headers={'authorization': "Bearer " + auth_code},
|
||||||
|
json={'name': 'prova3', 'owner_id': 'email'})
|
||||||
|
j = json.loads(r.text)
|
||||||
|
assert j['result'] == "success"
|
||||||
|
|
||||||
|
print("Repository_create eseguito correttamente!")
|
||||||
|
|
||||||
|
|
||||||
|
print("Testing del metodo repository_create")
|
||||||
|
|
Loading…
Reference in a new issue