def test_minos_api_proxy_controlled_exception_unreachable(): """If no value, raise exception""" proxy_instance = MinosProxyHTTP('http://localhost', 5001) params = {'address': 'test'} body = {'body': 'data'} with pytest.raises(MicroserviceUnreacheableError): req = proxy_instance.request(method='GET', path='/orders', params=params, data=body)
def test_minos_api_proxy_patch(): """API Proxy PATCH.""" proxy_instance = MinosProxyHTTP('http://localhost', 5000) params = {'address': 'test'} body = {'body': 'data'} req = proxy_instance.request(method='PATCH', path='/customer', params=params, data=body) assert req.status_code == 200 assert req.json() == [{'id': 1}]
def test_minos_api_proxy_controlled_exception_cb(): """If no value, raise exception""" proxy_instance = MinosProxyHTTP('http://localhost', 5001) params = {'address': 'test'} body = {'body': 'data'} with pytest.raises(ApiCircuitBreaker): raise ApiCircuitBreaker('Throwing an exception here!') req = proxy_instance.request(method='GET', path='/orders', params=params, data=body)
def test_minos_api_proxy_delete(): """API Proxy DELETE.""" proxy_instance = MinosProxyHTTP('http://localhost', 5000) params = {'address': 'test'} body = {'body': 'data'} req = proxy_instance.request(method='DELETE', path='/cart', params=params, data=body) assert req.status_code == 200 assert req.json() == [{'id': 1}]
def test_minos_api_proxy_get_kwargs(): """API Proxy GET.""" proxy_instance = MinosProxyHTTP('http://localhost', 5000, headers={"content-type": "text"}) params = {'address': 'test'} body = {'body': 'data'} req = proxy_instance.request(method='GET', path='/orders', params=params, data=body) assert req.status_code == 200 assert req.json() == [{'id': 1}]