-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
42 lines (33 loc) · 948 Bytes
/
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
import unittest
from .main import App
def TestInit():
import os
os.environ['MYSQL_HOST'] = 'localhost'
os.environ['MYSQL_PORT'] = '3306'
os.environ['MYSQL_USER'] = 'root'
os.environ['MYSQL_PASSWORD'] = ''
os.environ['MYSQL_CHARSET'] = 'utf8mb4'
TestInit()
class TestApp(unittest.TestCase):
def test_adduser(self):
"""测试初始化"""
App({
'<hostname>': 'localhost',
'<username>': 'testing',
'<password>': '',
'adduser': True,
}).adduser()
def test_passwd(self):
"""测试初始化"""
App({
'<hostname>': 'localhost',
'<username>': 'testing',
'<password>': '123456',
'adduser': True,
}).passwd()
def test_create_database(self):
App({
'<database>': 'testing',
'create': True,
'database': True,
}).passwd()