IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 14, 2019, 4:59:32 PM (7 years ago)
Author:
fairlamb
Message:

Tidy up tests, and removed now unused files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ipp-259_genericise_backups/tools/backups/confluence_backup_test.py

    r40937 r40944  
    1212
    1313
    14 JIRA_TEST_CONFIG = os.path.join(os.path.dirname(__file__), './testing/confluence_test.config')
     14CONF_TEST_CONFIG = os.path.join(os.path.dirname(__file__), './testing/confluence_test.config')
    1515
    1616
     
    113113
    114114    def test_load_from_config_file(self):
    115         jb = ConfluenceBackup(config_file=JIRA_TEST_CONFIG)
     115        jb = ConfluenceBackup(config_file=CONF_TEST_CONFIG)
    116116        self.assert_defaults(jb)
    117117
    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)
    123125
    124126    def test_default_arguments(self):
    125         jb = ConfluenceBackup(config_file=JIRA_TEST_CONFIG)
     127        jb = ConfluenceBackup(config_file=CONF_TEST_CONFIG)
    126128        self.assert_defaults(jb)
    127129
     
    166168
    167169    def test_nonexistant_config_file_raises_error(self):
    168         with pytest.raises(errs.ConfigError):
     170        with pytest.raises(errs.ValidationError) as e:
    169171            ConfluenceBackup("not a real file path")
     172        assert "ValidationError: Config filepath does not exist" in str(e)
    170173
    171174    def test_main_loads_default_and_fails_due_to_missing_paths(self):
    172175        with pytest.raises(errs.ValidationError) as e:
    173176            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)
    175178
    176179
     
    180183
    181184    def test_get_confluence_backup_date_format(self):
    182         jb = ConfluenceBackup(config_file=JIRA_TEST_CONFIG)
     185        jb = ConfluenceBackup(config_file=CONF_TEST_CONFIG)
    183186        today = datetime.date.today()
    184187        expected_format = today.strftime("%Y_%m_%d")
     
    190193
    191194    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)
    193196        # return_value = jb._copy_confluence_backup()
    194197        with pytest.raises(ValidationError) as e:
Note: See TracChangeset for help on using the changeset viewer.