Esempio n. 1
0
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
 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)
Esempio n. 6
0
    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)
Esempio n. 7
0
    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)
Esempio n. 8
0
 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)