def test_s3_object_storage_pass(self): self.patch(datamover, 'config') self.patch(datamover, 'apt_update') self.patch(datamover, 'status_set') self.patch(datamover, 'validate_backup') self.validate_backup.return_value = True self.patch(datamover, 'add_users') self.add_users.return_value = True self.patch(datamover, 'create_virt_env') self.create_virt_env.return_value = True self.patch(datamover, 'ensure_files') self.ensure_files.return_value = True self.patch(datamover, 'create_conf') self.create_conf.return_value = True self.patch(datamover, 'ensure_data_dir') self.ensure_data_dir.return_value = True self.patch(datamover, 'create_service_file') self.create_service_file.return_value = True self.patch(datamover, 'create_object_storage_service') self.create_object_storage_service.return_value = True self.patch(datamover, 'service_restart') self.patch(datamover, 'set_flag') self.patch(datamover, 'application_version_set') self.patch(datamover, 'get_new_version') self.patch(datamover.os, 'system') datamover.install_tvault_contego_plugin() self.service_restart.assert_called_with('tvault-contego') self.status_set.assert_called_with('active', 'Ready...') self.application_version_set.assert_called_once() self.set_flag.assert_called_with('tvault-contego.installed')
def test_s3_object_storage_fail(self): self.patch(datamover, 'config') self.config.return_value = 's3' self.patch(datamover, 'apt_update') self.patch(datamover, 'status_set') self.patch(datamover, 'validate_backup') self.validate_backup.return_value = True self.patch(datamover, 'add_users') self.add_users.return_value = True self.patch(datamover, 'create_virt_env') self.create_virt_env.return_value = True self.patch(datamover, 'ensure_files') self.ensure_files.return_value = True self.patch(datamover, 'create_conf') self.create_conf.return_value = True self.patch(datamover, 'ensure_data_dir') self.ensure_data_dir.return_value = True self.patch(datamover, 'create_service_file') self.create_service_file.return_value = True self.patch(datamover, 'create_object_storage_service') self.create_object_storage_service.return_value = False self.patch(datamover.os, 'system') self.patch(datamover, 'log') datamover.install_tvault_contego_plugin() self.status_set.assert_called_with( 'blocked', 'Failed while creating ObjectStore service file')
def test_invalid_ip(self): self.patch(datamover, 'config') self.patch(datamover, 'status_set') self.patch(datamover, 'validate_ip') self.validate_ip.return_value = False datamover.install_tvault_contego_plugin() self.status_set.assert_called_with( 'blocked', 'Invalid IP address, please provide correct IP address')
def test_install_tvault_contego_plugin(self): self.patch(datamover, 'install_tvault_contego_plugin') datamover.install_tvault_contego_plugin() self.install_tvault_contego_plugin.assert_called_once_with()