-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathciperpus_test_client.py
50 lines (37 loc) · 1.2 KB
/
ciperpus_test_client.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 ciperpus_exception import *
from ciperpus_test_exception import *
from ciperpus_test_context import *
from ciperpus_client import ciperpus_client
class ciperpus_test_client:
def __init__(self, client=None):
if client is None:
self.client = ciperpus_client()
else:
self.client = client
def login(self, username, password, expect_error=None, use_button=True):
with ciperpus_test_context(expect_error) as context:
self.client.login(username, password)
def logout(self, expect_error=None):
with ciperpus_test_context(expect_error) as context:
self.client.logout()
def dashboard(self, expect_error=None):
with ciperpus_test_context(expect_error) as context:
self.client.logout()
@property
def url(self):
return self.client.url
def check_url(self, endpoint):
return self.client.check_url(endpoint)
def close(self):
return self.client.close()
def quit(self):
return self.client.quit()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.quit()
test_client_instance = None
def get_test_client():
global test_client_instance
test_client_instance = test_client_instance or ciperpus_test_client()
return test_client_instance