def test_create_index(self, mock_index): meta.create_index('index1', ['first', 'second']) mock_index.assert_called_once_with('index1') mock_index().doc_type.assert_has_calls([ call('first'), call('second'), ], any_order=True) mock_index().create.assert_called_once_with()
def test_test_create_index_no_classes(self, mock_index, mock_get): mock_get.return_value = {'foo': 'bar'} meta.create_index('index1') mock_index.assert_called_once_with('index1') mock_index().doc_type.assert_has_calls([ call('bar')], any_order=True) mock_index().create.assert_called_once_with() mock_get.assert_called_once_with()