def test_clear_index(self, test_model, test_enum): """Test clearing the index of the shelves and devices.""" with mock.patch.object(test_model, 'clear_index') as index_clear: request = search_messages.SearchMessage(model=test_enum) response = self.service.clear(request) self.assertIsInstance(response, message_types.VoidMessage) self.assertEqual(index_clear.call_count, 1)
def test_reindex(self, test_model, test_enum): """Test reindexing the shelves and devices.""" with mock.patch.object(test_model, 'index_entities_for_search') as reindex: request = search_messages.SearchMessage(model=test_enum) response = self.service.reindex(request) self.assertIsInstance(response, message_types.VoidMessage) self.assertEqual(reindex.call_count, 1)
def test_reindex(self, expected_call, test_enum): """Test reindexing the shelves and devices.""" with mock.patch.object(deferred, 'defer') as mock_deferred: request = search_messages.SearchMessage(model=test_enum) response = self.service.reindex(request) self.assertIsInstance(response, message_types.VoidMessage) mock_deferred.assert_called_once_with(expected_call)
def testSearchMessage(self): search_messages_output = search_messages.SearchMessage() self.assertTrue(hasattr(search_messages_output, 'model'))