1 | """ |
||
2 | :Copyright: 2006-2020 Jochen Kupperschmidt |
||
3 | :License: Modified BSD, see LICENSE for details. |
||
4 | """ |
||
5 | |||
6 | import byceps.services.email.service as email_service |
||
7 | |||
8 | |||
9 | View Code Duplication | def test_create_minimal_config(email_admin_client): |
|
1 ignored issue
–
show
Duplication
introduced
by
Loading history...
|
|||
10 | config_id = 'acme-minimal' |
||
11 | assert email_service.find_config(config_id) is None |
||
12 | |||
13 | url = '/admin/email/configs' |
||
14 | form_data = { |
||
15 | 'config_id': config_id, |
||
16 | 'sender_address': '[email protected]', |
||
17 | } |
||
18 | response = email_admin_client.post(url, data=form_data) |
||
19 | |||
20 | config = email_service.find_config(config_id) |
||
21 | assert config is not None |
||
22 | assert config.id == config_id |
||
23 | assert config.sender is not None |
||
24 | assert config.sender.address == '[email protected]' |
||
25 | assert config.sender.name is None |
||
26 | assert config.contact_address is None |
||
27 | |||
28 | # Clean up. |
||
29 | email_service.delete_config(config_id) |
||
30 | |||
31 | |||
32 | View Code Duplication | def test_create_full_config(email_admin_client): |
|
1 ignored issue
–
show
|
|||
33 | config_id = 'acme-full' |
||
34 | assert email_service.find_config(config_id) is None |
||
35 | |||
36 | url = '/admin/email/configs' |
||
37 | form_data = { |
||
38 | 'config_id': config_id, |
||
39 | 'sender_address': '[email protected]', |
||
40 | 'sender_name': 'ACME Corp.', |
||
41 | 'contact_address': '[email protected]', |
||
42 | } |
||
43 | response = email_admin_client.post(url, data=form_data) |
||
44 | |||
45 | config = email_service.find_config(config_id) |
||
46 | assert config is not None |
||
47 | assert config.id == config_id |
||
48 | assert config.sender is not None |
||
49 | assert config.sender.address == '[email protected]' |
||
50 | assert config.sender.name == 'ACME Corp.' |
||
51 | assert config.contact_address == '[email protected]' |
||
52 | |||
53 | # Clean up. |
||
54 | email_service.delete_config(config_id) |
||
55 |