|
11 | 11 | from pi_portal.modules.mixins import read_json_file
|
12 | 12 |
|
13 | 13 | MOCK_INVALID_JSON = cast(user_config.TypeUserConfig, {"mock_setting": "0123"})
|
14 |
| -MOCK_VALID_JSON = cast( |
15 |
| - user_config.TypeUserConfig, |
16 |
| - { |
17 |
| - "AWS_ACCESS_KEY_ID": |
18 |
| - "... AWS key with write access to buckets ...", |
19 |
| - "AWS_SECRET_ACCESS_KEY": |
20 |
| - "... AWS secret key with write access buckets ...", |
21 |
| - "AWS_S3_BUCKETS": |
| 14 | +MOCK_VALID_JSON = user_config.TypeUserConfig( |
| 15 | + **{ |
| 16 | + "ARCHIVAL": |
22 | 17 | {
|
23 |
| - "LOGS": "... s3 logs bucket name ...", |
24 |
| - "VIDEOS": "... s3 video bucket name ..." |
| 18 | + "AWS": |
| 19 | + { |
| 20 | + "AWS_ACCESS_KEY_ID": |
| 21 | + "... AWS key with write access ...", |
| 22 | + "AWS_SECRET_ACCESS_KEY": |
| 23 | + "... AWS secret key with write access ...", |
| 24 | + "AWS_S3_BUCKETS": |
| 25 | + { |
| 26 | + "LOGS": "... s3 logs bucket name ...", |
| 27 | + "VIDEOS": "... s3 video bucket name ..." |
| 28 | + }, |
| 29 | + } |
| 30 | + }, |
| 31 | + "CHAT": |
| 32 | + { |
| 33 | + "SLACK": |
| 34 | + { |
| 35 | + "SLACK_APP_SIGNING_SECRET": |
| 36 | + "... secret value from slack ...", |
| 37 | + "SLACK_APP_TOKEN": |
| 38 | + "... token from slack ...", |
| 39 | + "SLACK_BOT_TOKEN": |
| 40 | + "... token from slack ...", |
| 41 | + "SLACK_CHANNEL": |
| 42 | + "... proper name of slack channel ...", |
| 43 | + "SLACK_CHANNEL_ID": |
| 44 | + ".. slack's ID for the channel ...", |
| 45 | + }, |
| 46 | + }, |
| 47 | + "LOGS": { |
| 48 | + "LOGZ_IO": { |
| 49 | + "LOGZ_IO_TOKEN": "... logz io's logger token ..." |
| 50 | + } |
| 51 | + }, |
| 52 | + "SWITCHES": |
| 53 | + { |
| 54 | + "CONTACT_SWITCHES": |
| 55 | + [ |
| 56 | + { |
| 57 | + "NAME": "... name and pin-out of a GPIO switch...", |
| 58 | + "GPIO": 12, |
| 59 | + }, |
| 60 | + ], |
25 | 61 | },
|
26 |
| - "CONTACT_SWITCHES": |
27 |
| - [ |
28 |
| - { |
29 |
| - "NAME": "... name and pin-out of a GPIO switch...", |
30 |
| - "GPIO": 12, |
31 |
| - }, |
32 |
| - ], |
33 |
| - "LOGZ_IO_CODE": |
34 |
| - "... logz io's logger code ...", |
35 |
| - "SLACK_APP_SIGNING_SECRET": |
36 |
| - "... secret value from slack to validate bot messages ...", |
37 |
| - "SLACK_APP_TOKEN": |
38 |
| - "... token from slack to allow app to use websockets ...", |
39 |
| - "SLACK_BOT_TOKEN": |
40 |
| - "... token from slack ...", |
41 |
| - "SLACK_CHANNEL": |
42 |
| - "... proper name of slack channel ...", |
43 |
| - "SLACK_CHANNEL_ID": |
44 |
| - ".. slack's ID for the channel ...", |
45 | 62 | "TEMPERATURE_SENSORS":
|
46 | 63 | {
|
47 | 64 | "DHT11":
|
@@ -114,15 +131,9 @@ def test_validate__invalid_configuration(
|
114 | 131 | user_configuration_instance.validate()
|
115 | 132 |
|
116 | 133 | assert json.loads(str(exc.value)) == [
|
117 |
| - "'AWS_ACCESS_KEY_ID' is a required property", |
118 |
| - "'AWS_SECRET_ACCESS_KEY' is a required property", |
119 |
| - "'AWS_S3_BUCKETS' is a required property", |
120 |
| - "'CONTACT_SWITCHES' is a required property", |
121 |
| - "'LOGZ_IO_CODE' is a required property", |
122 |
| - "'SLACK_APP_SIGNING_SECRET' is a required property", |
123 |
| - "'SLACK_APP_TOKEN' is a required property", |
124 |
| - "'SLACK_BOT_TOKEN' is a required property", |
125 |
| - "'SLACK_CHANNEL' is a required property", |
126 |
| - "'SLACK_CHANNEL_ID' is a required property", |
| 134 | + "'ARCHIVAL' is a required property", |
| 135 | + "'CHAT' is a required property", |
| 136 | + "'LOGS' is a required property", |
| 137 | + "'SWITCHES' is a required property", |
127 | 138 | "'TEMPERATURE_SENSORS' is a required property",
|
128 | 139 | ]
|
0 commit comments