- Timestamp:
- Oct 14, 2019, 4:59:32 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ipp-259_genericise_backups/tools/backups/confluence_backup_test.py
r40937 r40944 12 12 13 13 14 JIRA_TEST_CONFIG = os.path.join(os.path.dirname(__file__), './testing/confluence_test.config')14 CONF_TEST_CONFIG = os.path.join(os.path.dirname(__file__), './testing/confluence_test.config') 15 15 16 16 … … 113 113 114 114 def test_load_from_config_file(self): 115 jb = ConfluenceBackup(config_file= JIRA_TEST_CONFIG)115 jb = ConfluenceBackup(config_file=CONF_TEST_CONFIG) 116 116 self.assert_defaults(jb) 117 117 118 def test_default_config_loads_with_no_args(self): 119 default_config = jbck_mod.DEFAULT_CONFIG_FILE 120 assert os.path.exists(default_config) 121 jb = ConfluenceBackup() 122 self.assert_defaults(jb) 118 def test_default_config_fails_to_load_if_the_file_does_not_exist(self): 119 default_config = jbck_mod.EXPECTED_CONFIG_FILE 120 assert not os.path.exists(default_config) 121 122 with pytest.raises(errs.ValidationError) as e: 123 ConfluenceBackup() 124 assert "ValidationError: Config filepath does not exist" in str(e) 123 125 124 126 def test_default_arguments(self): 125 jb = ConfluenceBackup(config_file= JIRA_TEST_CONFIG)127 jb = ConfluenceBackup(config_file=CONF_TEST_CONFIG) 126 128 self.assert_defaults(jb) 127 129 … … 166 168 167 169 def test_nonexistant_config_file_raises_error(self): 168 with pytest.raises(errs. ConfigError):170 with pytest.raises(errs.ValidationError) as e: 169 171 ConfluenceBackup("not a real file path") 172 assert "ValidationError: Config filepath does not exist" in str(e) 170 173 171 174 def test_main_loads_default_and_fails_due_to_missing_paths(self): 172 175 with pytest.raises(errs.ValidationError) as e: 173 176 jbck_mod.main() 174 assert "ValidationError: target path does not exist:" in str(e)177 assert "ValidationError: Config filepath does not exist" in str(e) 175 178 176 179 … … 180 183 181 184 def test_get_confluence_backup_date_format(self): 182 jb = ConfluenceBackup(config_file= JIRA_TEST_CONFIG)185 jb = ConfluenceBackup(config_file=CONF_TEST_CONFIG) 183 186 today = datetime.date.today() 184 187 expected_format = today.strftime("%Y_%m_%d") … … 190 193 191 194 def test_copying_fails_if_paths_not_present(self): 192 jb = ConfluenceBackup(config_file= JIRA_TEST_CONFIG)195 jb = ConfluenceBackup(config_file=CONF_TEST_CONFIG) 193 196 # return_value = jb._copy_confluence_backup() 194 197 with pytest.raises(ValidationError) as e:
Note:
See TracChangeset
for help on using the changeset viewer.
