-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.py
50 lines (38 loc) · 1.84 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from fastapi.testclient import TestClient
from main import *
import pytest
client = TestClient(app)
class Test_Amizone():
def test_client(self):
response = client.get("/")
assert response.status_code == 200
@pytest.mark.xfail(reason="Expected failure due to incorrect credentials")
def test_login(self):
username = 'incorrect_username'
password = 'incorrect_password'
response = client.post('/login', data={'username': username, 'password': password})
assert response.status_code == 200
def test_profile(self):
response = client.get('/profile', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401
def test_courses(self):
response = client.get('/courses', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401
def test_result(self):
response = client.get('/result', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401
def test_faculty(self):
response = client.get('/faculty', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401
def test_exam_schedule(self):
response = client.get('/exam_schedule', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401
def test_timetable(self):
response = client.get('/timetable', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401
def test_sem_count(self):
response = client.get('/sem_count', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401
def test_cookie_status(self):
response = client.get('/cookie_status', headers={'session-cookie': 'incorrect_cookie'})
assert response.status_code == 401