-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitTests.py
32 lines (24 loc) · 945 Bytes
/
UnitTests.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
import unittest
from src.user import User
from src.user.components.login import Login
from src.const import ACCOUNTS_DATA
import random
class TestLogin(unittest.TestCase):
def setUp(self):
self.user_id = random.choice(list(ACCOUNTS_DATA.keys()))
self.login = Login(self.user_id)
def test_login_json_response(self):
res = self.login.login()
self.assertIsInstance(res.json(), dict)
def test_login_success(self):
res = self.login.login()
self.assertTrue(res.json()["success"], True)
class TestPXCaptcha(unittest.TestCase):
def setUp(self):
self.user_id = random.choice(list(ACCOUNTS_DATA.keys()))
self.login = Login(self.user_id)
def test_pxcaptcha_bypass(self):
self.login.session.headers = {"User-Agent": "Googlebot-Image/1.0"} # Triggering bot system
res = self.login.login()
self.assertTrue(res.status_code, 200)
unittest.main()