Exemple #1
0
 def test_stop_service(self):
     reg = InMemoryServiceRegistry()
     server = mock.Mock()
     reg.register(SecondaryService(service_metadata=dummy_service_metadata, host='oeo.net', port=5678, server=server))
     # Stop service
     reg.stop_service('s1234')
     server.stop.assert_called_with()
     # service should be gone now
     with pytest.raises(ServiceNotFoundException):
         reg.get_metadata('s1234')
     with pytest.raises(ServiceNotFoundException):
         reg.stop_service('s1234')
Exemple #2
0
 def test_stop_service(self):
     reg = InMemoryServiceRegistry()
     server = mock.Mock()
     reg.register(dummy_service_metadata.id, SecondaryService(host='oeo.net', port=5678, server=server))
     reg.persist(user_id='u9876', metadata=dummy_service_metadata, api_version="0.4.0")
     # Stop service
     reg.stop_service('u9876', 's1234')
     server.stop.assert_called_with()
     # service should be gone now
     with pytest.raises(ServiceNotFoundException):
         reg.get_metadata('u9876', 's1234')
     with pytest.raises(ServiceNotFoundException):
         reg.stop_service('u9876', 's1234')
Exemple #3
0
 def test_get_metadata(self):
     reg = InMemoryServiceRegistry()
     server = mock.Mock()
     reg.register(SecondaryService(service_metadata=dummy_service_metadata, host='oeo.net', port=5678, server=server))
     assert reg.get_metadata('s1234') == dummy_service_metadata
     assert reg.get_metadata_all() == {'s1234': dummy_service_metadata}
Exemple #4
0
 def test_get_metadata(self):
     reg = InMemoryServiceRegistry()
     reg.persist(user_id='u9876', metadata=dummy_service_metadata, api_version="0.4.0")
     assert reg.get_metadata('u9876', 's1234') == dummy_service_metadata
     assert reg.get_metadata_all('u9876') == {'s1234': dummy_service_metadata}