-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
35 lines (26 loc) · 939 Bytes
/
test.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
import logging
import os
import unittest
from PKULogin import PKULogin, APPS, logger, SyllabusLogin
logger.setLevel(logging.DEBUG)
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG)
logger.addHandler(console_handler)
class TestStringMethods(unittest.TestCase):
def setUp(self) -> None:
super().setUp()
self.username = os.environ["PKU_STUDENT_ID"]
self.password = os.environ["PKU_PASSWORD"]
def test_login(self):
login = PKULogin(self.username, self.password)
for app in APPS:
login.login(APPS[app])
def test_syllabus(self):
login = SyllabusLogin(self.username, self.password)
login.login()
self.assertEqual(
login.session.get(
"https://elective.pku.edu.cn/elective2008/edu/pku/stu/elective/controller/electiveWork/showResults.do"
).status_code,
200
)