예제 #1
0
 def test_create_repository_repo_already_in_results(self):
     client = Mock()
     client.snapshot.get_repository.return_value = {'repo': {'foo': 'bar'}}
     with self.assertRaises(SystemExit) as cm:
         curator.create_repository(client,
                                   repository="repo",
                                   repo_type="fs")
     self.assertEqual(cm.exception.code, 1)
예제 #2
0
 def test_create_repository_empty_result_call(self):
     client = Mock()
     client.snapshot.get_repository.return_value = None
     self.assertTrue(
         curator.create_repository(client,
                                   repository="repo",
                                   repo_type="fs"))
예제 #3
0
 def test_create_repository_repo_not_in_results(self):
     client = Mock()
     client.snapshot.get_repository.return_value = {
         'not_your_repo': {
             'foo': 'bar'
         }
     }
     self.assertTrue(
         curator.create_repository(client,
                                   repository="repo",
                                   repo_type="fs"))
예제 #4
0
 def test_create_repository_exception(self):
     client = Mock()
     client.snapshot.get_repository.return_value = {
         'not_your_repo': {
             'foo': 'bar'
         }
     }
     client.snapshot.create_repository.side_effect = elasticsearch.TransportError(
         500, "Error message", {"message": "Error"})
     self.assertRaises(
         Exception,
         curator.create_repository(client,
                                   repository="repo",
                                   repo_type="fs"))
예제 #5
0
 def test_create_repository_missing_arg(self):
     client = Mock()
     with self.assertRaises(SystemExit) as cm:
         curator.create_repository(client)
     self.assertEqual(cm.exception.code, 1)