Ejemplo n.º 1
0
 def test_get_elements(self):
     # Test that we can handle SOAP-level error messages
     # TODO: The request actually raises ErrorInvalidRequest, but we interpret that to mean a wrong API version and
     # end up throwing ErrorInvalidServerVersion. We should make a more direct test.
     svc = ResolveNames(self.account.protocol)
     with self.assertRaises(ErrorInvalidServerVersion):
         svc._get_elements(create_element('XXX'))
Ejemplo n.º 2
0
 def test_handle_backoff(self):
     # Test that we can handle backoff messages
     svc = ResolveNames(self.account.protocol)
     tmp = svc._response_generator
     orig_policy = self.account.protocol.config.retry_policy
     try:
         # We need to fail fast so we don't end up in an infinite loop
         self.account.protocol.config.retry_policy = FailFast()
         svc._response_generator = Mock(
             side_effect=ErrorServerBusy("XXX", back_off=1))
         with self.assertRaises(ErrorServerBusy) as e:
             list(svc._get_elements(create_element("XXX")))
         self.assertEqual(e.exception.args[0], "XXX")
     finally:
         svc._response_generator = tmp
         self.account.protocol.config.retry_policy = orig_policy