Pārlūkot izejas kodu

[beeswax] Raise an exception if the beeswax query failed

Erick Tryzelaar 10 gadi atpakaļ
vecāks
revīzija
4b9dee3
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 9 0
      apps/beeswax/src/beeswax/test_base.py

+ 9 - 0
apps/beeswax/src/beeswax/test_base.py

@@ -193,6 +193,10 @@ def wait_for_query_to_finish(client, response, max=60.0):
     return response
 
   content = json.loads(response.content)
+
+  if content.get('status') == -1:
+    raise Exception('Query failed: %s' % content.get('message'))
+
   watch_url = content['watch_url']
 
   response = client.get(watch_url, follow=True)
@@ -208,6 +212,11 @@ def wait_for_query_to_finish(client, response, max=60.0):
 
     response = client.get(watch_url, follow=True)
 
+  content = json.loads(response.content)
+
+  if content.get('status') == -1:
+    raise Exception('Query failed: %s' % content.get('message'))
+
   return response