def test_fetch_remote_object_with_exception(self, mock_fetch_by_resource_uri, mock_sleep): mock_fetch_by_resource_uri.side_effect = [dockercloud.ObjectNotFound("This is an error"), self.container] self.assertEqual(self.container, fetch_remote_obj("uri")) mock_sleep.assert_called_once_with(API_RETRY)
def test_fetch_remote_object(self, mock_fetch_by_resource_uri): self.assertIsNone(fetch_remote_obj("")) mock_fetch_by_resource_uri.return_value = self.container self.assertEqual(self.container, fetch_remote_obj("uri"))