def test_fulfillment_unknown_client_error(self): """ Verify that the task raises an exception when fulfillment fails because of an unknown client error. """ responses.add(responses.PUT, self.API_URL, status=404, body="{}") with self.assertRaises(exceptions.HttpClientError): fulfill_order(self.ORDER_NUMBER)
def test_fulfillment_not_possible(self): """Verify that the task exits without an error when fulfillment is not possible.""" httpretty.register_uri(httpretty.PUT, self.API_URL, status=406, body={}) with self.assertRaises(Ignore): fulfill_order(self.ORDER_NUMBER)
def test_fulfillment_unknown_client_error(self): """ Verify that the task raises an exception when fulfillment fails because of an unknown client error. """ httpretty.register_uri(httpretty.PUT, self.API_URL, status=404, body={}) with self.assertRaises(exceptions.HttpClientError): fulfill_order(self.ORDER_NUMBER)
def test_requires_configuration(self, setting): """Verify that the task refuses to run without the configuration it requires.""" with mock.patch('ecommerce_worker.configuration.test.' + setting, None): with self.assertRaises(RuntimeError): fulfill_order(self.ORDER_NUMBER)
def test_fulfillment_not_possible(self): """Verify that the task exits without an error when fulfillment is not possible.""" responses.add(responses.PUT, self.API_URL, status=406, body="{}") with self.assertRaises(Ignore): fulfill_order(self.ORDER_NUMBER)