1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-28 23:44:19 +00:00

aggiunti metodi get, patch e delete per repositories_test, impostato TODO per l'aggiunta di patch e get per user_delete_test

This commit is contained in:
Annielated 2021-05-01 01:28:57 +02:00
parent 54d8f4e053
commit 36b652eb2f
3 changed files with 33 additions and 27 deletions

View file

@ -1,27 +0,0 @@
import json
import unittest
import requests
class MyTestCase(unittest.TestCase):
def test_repository_edit(self):
global auth_code
r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'password'})
j = json.loads(r.text)
assert j['result'] == "success"
auth_code = j['data']['access_token']
r = requests.put(f'http://localhost:5000/api/repository/edit', headers={'authorization': "Bearer " + auth_code},
json={'id': '1', 'name': 'newname'})
j = json.loads(r.text)
assert j['result'] == "success"
print('Repository_edit eseguito correttamente!')
print('Testing del metodo repository_edit')

View file

@ -0,0 +1,32 @@
import json
import unittest
import requests
class MyTestCase(unittest.TestCase):
def test_repository_edit(self):
global auth_code
# eseguo il login
r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'admin@admin.com', 'password': 'password'})
j = json.loads(r.text)
assert j['result'] == "success"
auth_code = j['data']['access_token']
# ritorno le info sulla repo speficicata dopo /repositories
#r = requests.get(f'http://localhost:5000/api/v1/repositories/3', headers={'authorization': "Bearer " + auth_code})
#j = json.loads(r.text)
#assert j['result'] == "success"
r = requests.delete(f'http://localhost:5000/api/v1/repositories/1', headers={'authorization': "Bearer " + auth_code})
j = json.loads(r.text)
assert j['result'] == 'success'
print('Testing del metodo repository_edit')

View file

@ -49,6 +49,7 @@ class MyTestCase(unittest.TestCase):
j = json.loads(r.text) j = json.loads(r.text)
assert j['result'] == "success" assert j['result'] == "success"
# TODO AGGIUNGERE TESTING DI GET E PATCH
print("User_delete eseguito correttamente!") print("User_delete eseguito correttamente!")
print("Testing del metodo user delete") print("Testing del metodo user delete")