2021-04-30 23:28:57 +00:00
|
|
|
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
|
2021-05-01 13:32:07 +00:00
|
|
|
r = requests.get(f'http://localhost:5000/api/v1/repositories/15', headers={'authorization': "Bearer " + auth_code})
|
2021-05-01 10:29:10 +00:00
|
|
|
j = json.loads(r.text)
|
|
|
|
assert j['result'] == "success"
|
2021-04-30 23:28:57 +00:00
|
|
|
|
2021-05-01 13:32:07 +00:00
|
|
|
r = requests.delete(f'http://localhost:5000/api/v1/repositories/15', headers={'authorization': "Bearer " + auth_code})
|
2021-04-30 23:28:57 +00:00
|
|
|
j = json.loads(r.text)
|
|
|
|
assert j['result'] == 'success'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print('Testing del metodo repository_edit')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|