10
10
CONFIG_FILES = {"valid" : "tests/fixtures/configuration.yaml" ,
11
11
"invalid" : "tests/fixtures/configuration_invalid.yaml" ,
12
12
"client_params" : "tests/fixtures/configuration_conn_params.yaml" }
13
- VALIDATION_FILES = {"valid" : "tests/fixtures/validation.yaml" }
14
13
15
-
16
- def setup_config_object (config_file , validation_file ) -> Config :
17
- """Creates a Config object using the provided config and validation files"""
14
+ def setup_config_object (config_file ) -> Config :
15
+ """Creates a Config object using the provided config files"""
18
16
with mock .patch .dict (
19
17
os .environ , {
20
18
"CONFIG_FILE_PATH" : config_file ,
21
- "VALIDATION_FILE_PATH" : validation_file
22
19
}):
23
20
return Config ()
24
21
@@ -30,9 +27,9 @@ def setUp(self):
30
27
"""Set up dummy configs for us."""
31
28
self .maxDiff = None
32
29
self .config = setup_config_object (
33
- CONFIG_FILES ["valid" ], VALIDATION_FILES [ "valid" ] )
30
+ CONFIG_FILES ["valid" ])
34
31
self .client_params_config = setup_config_object (
35
- CONFIG_FILES ["client_params" ], VALIDATION_FILES [ "valid" ] )
32
+ CONFIG_FILES ["client_params" ])
36
33
37
34
def test_invalid_get_property (self ):
38
35
"""Tests getting invalid properties returns None type"""
@@ -113,15 +110,15 @@ def test_load_and_validate_schema_exception_exit(self):
113
110
"""Tests that the program exits when loading a configuration file with a schema exception"""
114
111
with self .assertRaises (SystemExit ) as cm :
115
112
setup_config_object (
116
- CONFIG_FILES ["invalid" ], VALIDATION_FILES [ "valid" ] )
113
+ CONFIG_FILES ["invalid" ])
117
114
self .assertEqual (1 , cm .exception .code )
118
115
119
116
def test_load_and_validate_schema_exception_error_log (self ):
120
117
"""Tests that an error is logged when loading a config file with a schema exception"""
121
118
try :
122
119
with capture_logs () as captured :
123
120
setup_config_object (
124
- CONFIG_FILES ["invalid" ], VALIDATION_FILES [ "valid" ] )
121
+ CONFIG_FILES ["invalid" ])
125
122
except SystemExit :
126
123
# Catch and pass on expected SystemExit so tests keep running
127
124
pass
@@ -132,7 +129,7 @@ def test_load_and_validate_no_error_log(self):
132
129
try :
133
130
with capture_logs () as captured :
134
131
setup_config_object (
135
- CONFIG_FILES ["valid" ], VALIDATION_FILES [ "valid" ] )
132
+ CONFIG_FILES ["valid" ])
136
133
except SystemExit :
137
134
# Catch and pass on expected SystemExit so tests keep running
138
135
pass
0 commit comments