mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 04:54:18 +00:00
importato unittest, rimossa chiamata della funzione che ora avviene grazie al parametro self
This commit is contained in:
parent
aaab6094a9
commit
8c5cb1735c
1 changed files with 16 additions and 14 deletions
|
@ -1,23 +1,25 @@
|
|||
import unittest
|
||||
import requests
|
||||
import json
|
||||
|
||||
auth_code = ""
|
||||
|
||||
|
||||
def test_login():
|
||||
global auth_code
|
||||
r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'amogus'})
|
||||
j = json.loads(r.text)
|
||||
assert j['result'] == "failure"
|
||||
r = requests.post('http://localhost:5000/api/login', json={'email': '', 'password': ''})
|
||||
j = json.loads(r.text)
|
||||
assert j['result'] == "failure"
|
||||
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']
|
||||
print("Login eseguito correttamente!")
|
||||
class MyTestCase(unittest.TestCase):
|
||||
def test_login(self):
|
||||
global auth_code
|
||||
r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'amogus'})
|
||||
j = json.loads(r.text)
|
||||
assert j['result'] == "failure"
|
||||
r = requests.post('http://localhost:5000/api/login', json={'email': '', 'password': ''})
|
||||
j = json.loads(r.text)
|
||||
assert j['result'] == "failure"
|
||||
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']
|
||||
print("Login eseguito correttamente!")
|
||||
|
||||
|
||||
print("Testing del login")
|
||||
test_login()
|
||||
|
||||
|
|
Loading…
Reference in a new issue