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

importato unittest, rimossa chiamata della funzione che ora avviene grazie al parametro self

This commit is contained in:
Annielated 2021-04-28 23:14:21 +02:00
parent aaab6094a9
commit 8c5cb1735c

View file

@ -1,23 +1,25 @@
import unittest
import requests import requests
import json import json
auth_code = "" auth_code = ""
def test_login(): class MyTestCase(unittest.TestCase):
global auth_code def test_login(self):
r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'amogus'}) global auth_code
j = json.loads(r.text) r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'amogus'})
assert j['result'] == "failure" j = json.loads(r.text)
r = requests.post('http://localhost:5000/api/login', json={'email': '', 'password': ''}) assert j['result'] == "failure"
j = json.loads(r.text) r = requests.post('http://localhost:5000/api/login', json={'email': '', 'password': ''})
assert j['result'] == "failure" j = json.loads(r.text)
r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'password'}) assert j['result'] == "failure"
j = json.loads(r.text) r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'password'})
assert j['result'] == "success" j = json.loads(r.text)
auth_code = j['data']['access_token'] assert j['result'] == "success"
print("Login eseguito correttamente!") auth_code = j['data']['access_token']
print("Login eseguito correttamente!")
print("Testing del login") print("Testing del login")
test_login()