def test_ok_if_at_least_one_file_doesnt_exist(self, is_file_mock): is_file_mock.side_effect = lambda fn: False if fn == 'file2' else True check = FilesExistHealthCheck(('file1', 'file2'), check_id='checkid') check.run() self.assertFalse(check.is_ok) self.assertEqual(check.details, {'file1': 'exists', 'file2': 'NO SUCH FILE'})
def test_ok_if_all_files_exist(self, is_file_mock): is_file_mock.return_value = True check = FilesExistHealthCheck(('file1', 'file2'), check_id='checkid') check.run() self.assertTrue(check.is_ok) self.assertEqual(check.details, {'file1': 'exists', 'file2': 'exists'})