This repository was archived by the owner on Jun 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_client.py
More file actions
executable file
·72 lines (61 loc) · 1.8 KB
/
test_client.py
File metadata and controls
executable file
·72 lines (61 loc) · 1.8 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Testing app for client class."""
from clients.client import Client
def test_client_integrity():
"""Test the client class integrity."""
client_1 = Client(
client_id='WEHW01',
company='Wurst Entertainment',
salutation='Herr',
name='Hans',
family_name='Wurst',
street='Würstchenstraße 85',
post_code='11183',
city='Bockwurstingen',
language='de'
)
client_2 = Client(
client_id='WEHW02',
company='Wurst Entertainment',
salutation='Frau',
name='Hansina',
family_name='Wurst',
street='Würstchenstraße 85',
post_code='11183',
city='Bockwurstingen',
language='de'
)
client_3 = Client(
client_id='BCIP01',
company='Big Company',
salutation='Mr.',
name='Important',
family_name='Person',
street='Famous-Street 35',
post_code='356cb',
city='Famous-Town',
language='en'
)
# add them all to the global client_list
client_list = []
client_list.append(client_1)
client_list.append(client_2)
client_list.append(client_3)
def test_client_json_conversion():
"""Test conversion of client object to / from json."""
client_4 = Client(
client_id='ABAB01',
company='Abi Bubi',
salutation='Herr',
name='Abridula',
family_name='Badeldecku',
street='Am Stackelstick 113',
post_code='33947',
city='Fummelbummel',
language='de'
)
# get new client from existing one via json
new_client = Client().from_json(js=client_4.to_json())
# both live in the same street
assert client_4.street == new_client.street
# both have the same ID
assert client_4.client_id == new_client.client_id