-
Notifications
You must be signed in to change notification settings - Fork 10
/
ci-test.py
43 lines (33 loc) · 1.24 KB
/
ci-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
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import os
import unittest
from binascii import a2b_hex
from binascii import b2a_hex
from lib.clipher import AESCipher
from signin.unicomapp import UnicomApp
from signin.jd import JD, JDUser
from lib.conf import UNICOMAPP, JDong
def test_aes():
key = 'f6b0d3f905bf02939b4f6d29f257c2ab'
iv = '1a42eb4565be8628a807403d67dce78d'
mobile = b'13266668888123456'
mobile_cipher = b'33ab20e85b0453be9cf56a85bf5108b408e6fc628ae9e7f75b16cf74e886c68d'
passwd = b'666888123456'
passwd_cipher = b'6eae39d7dcc618fd9b6efaac88ec18da'
aes = AESCipher(key, iv=iv)
assert b2a_hex(aes.encrypt(mobile)) == mobile_cipher
assert b2a_hex(aes.encrypt(passwd)) == passwd_cipher
assert aes.decrypt(a2b_hex(mobile_cipher)) == mobile
assert aes.decrypt(a2b_hex(passwd_cipher)) == passwd
class TestSignin(unittest.TestCase):
def test_unicomapp(self):
username = os.getenv('unicomapp_username') or UNICOMAPP['username']
password = os.getenv('unicomapp_password') or UNICOMAPP['password']
unicomapp = UnicomApp()
self.assertTrue(unicomapp.login(username, password))
self.assertTrue(unicomapp.signin())
if __name__ == "__main__":
unittest.main()