def test_register_service_public(self): collection_mock = mock.Mock(spec=["insert_one", "find_one", "count"]) collection_mock.count.return_value = 0 store = ServiceRegistry(collection=collection_mock) store.register_service(url=self.service_public['url'], name=self.service_public['name'], public=True) collection_mock.insert_one.assert_called_with(self.service_public)
def test_register_service_with_special_name(self): collection_mock = mock.Mock(spec=["insert_one", "find_one", "count"]) collection_mock.count.return_value = 0 store = ServiceRegistry(collection=collection_mock) store.register_service(url="http://wonderload", name="A special Name") collection_mock.insert_one.assert_called_with({ 'url': 'http://wonderload', 'type': 'wps', 'name': 'a_special_name', 'public': False, 'c4i': False})