IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 4, 2019, 4:50:00 PM (7 years ago)
Author:
fairlamb
Message:

that function was used - moved it to generic; separated out jira/conf tar

File:
1 edited

Legend:

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

    r40898 r40912  
    99import backups.full_atlassian_backup_test as fab_test
    1010import backups.utils.subprocess_utils as sub_utils
     11import backups.utils.generic_utils as gen_utils
    1112
    1213from backups.backup_atlassian_applications import AtlassianBackups
     14from backups.utils.errors import ValidationError
    1315
    1416TEST_DEFAULT_CONFIG_FILE = os.path.join(os.path.dirname(__file__), './testing/test.config')
     
    215217        destination_paths = [ "/Two", "/paths"]
    216218
    217         return_is_non_zero = baa._move_dir_contents_to_dir(source_paths, destination_paths)
    218         assert return_is_non_zero != 0
     219        with pytest.raises(ValidationError):
     220            gen_utils.move_dirs(source_paths, destination_paths)
    219221
    220222    def test_moving_old_backups(self, tmpdir):
     
    275277
    276278        # run the move
    277         return_result = baa._move_dir_contents_to_dir(source_paths, destination_paths)
     279        return_result = gen_utils.move_dirs(source_paths, destination_paths)
    278280        assert return_result == 0
    279281
     
    357359class TestTaringOfAttachments(object):
    358360
    359     def test_attachments_tar(self, tmpdir):
     361    def test_jira_attachments_tar(self, tmpdir):
    360362
    361363        ab = AtlassianBackups(config_file=TEST_DEFAULT_CONFIG_FILE)
     
    364366        today = datetime.date.today().strftime("%Y_%m_%d")
    365367        jira_tar_name = today + "_jira_attachments.tar"
     368        expected_jira_host_tar = os.path.join(ab.host_backup_path, "latest", jira_tar_name)
     369        expected_jira_bak1_tar = os.path.join(ab.backup_1_path, "latest", jira_tar_name)
     370        expected_jira_bak2_tar = os.path.join(ab.backup_2_path, "latest", jira_tar_name)
     371        assert not os.path.exists(expected_jira_host_tar)
     372        assert not os.path.exists(expected_jira_bak1_tar)
     373        assert not os.path.exists(expected_jira_bak2_tar)
     374
     375        tar_result = ab._tar_jira_attachments()
     376        assert tar_result == 0
     377
     378        assert os.path.exists(expected_jira_host_tar)
     379        assert os.path.exists(expected_jira_bak1_tar)
     380        assert os.path.exists(expected_jira_bak2_tar)
     381
     382    def test_conf_attachments_tar(self, tmpdir):
     383
     384        ab = AtlassianBackups(config_file=TEST_DEFAULT_CONFIG_FILE)
     385        ab = fab_test.create_all_paths_and_folders(ab, tmpdir)
     386
     387        today = datetime.date.today().strftime("%Y_%m_%d")
    366388        conf_tar_name = today + "_confluence_attachments.tar"
    367         expected_jira_host_tar = os.path.join(ab.host_backup_path, "latest", jira_tar_name)
    368389        expected_conf_host_tar = os.path.join(ab.host_backup_path, "latest", conf_tar_name)
    369         expected_jira_bak1_tar = os.path.join(ab.backup_1_path, "latest", jira_tar_name)
    370390        expected_conf_bak1_tar = os.path.join(ab.backup_1_path, "latest", conf_tar_name)
    371         expected_jira_bak2_tar = os.path.join(ab.backup_2_path, "latest", jira_tar_name)
    372391        expected_conf_bak2_tar = os.path.join(ab.backup_2_path, "latest", conf_tar_name)
    373         assert not os.path.exists(expected_jira_host_tar)
    374392        assert not os.path.exists(expected_conf_host_tar)
    375         assert not os.path.exists(expected_jira_bak1_tar)
    376393        assert not os.path.exists(expected_conf_bak1_tar)
    377         assert not os.path.exists(expected_jira_bak2_tar)
    378394        assert not os.path.exists(expected_conf_bak2_tar)
    379395
    380         tar_result = ab._tar_attachments()
     396        tar_result = ab._tar_conf_attachments()
    381397        assert tar_result == 0
    382398
    383         assert os.path.exists(expected_jira_host_tar)
    384399        assert os.path.exists(expected_conf_host_tar)
    385         assert os.path.exists(expected_jira_bak1_tar)
    386400        assert os.path.exists(expected_conf_bak1_tar)
    387         assert os.path.exists(expected_jira_bak2_tar)
    388401        assert os.path.exists(expected_conf_bak2_tar)
    389402
Note: See TracChangeset for help on using the changeset viewer.