Browse Source

HUE-3652 [editor] Update Get History test to correctly check for the query type

Romain Rigaux 9 years ago
parent
commit
7233d3a

+ 2 - 1
desktop/libs/notebook/src/notebook/api.py

@@ -322,12 +322,13 @@ def get_history(request):
         'name': doc.name,
         'id': doc.id,
         'uuid': doc.uuid,
+        'type': doc.type,
         'data': {
             'statement_raw': notebook['snippets'][0]['statement_raw'][:1001],
             'lastExecuted':  notebook['snippets'][0]['lastExecuted'],
             'status':  notebook['snippets'][0]['status'],
             'parentUuid': notebook.get('parentUuid', '')
-        },
+        } if notebook['snippets'] else {},
         'absoluteUrl': doc.get_absolute_url(),
       })
     else:

+ 1 - 1
desktop/libs/notebook/src/notebook/tests.py

@@ -150,7 +150,7 @@ class TestNotebookApi(object):
     data = json.loads(response.content)
     assert_equal(0, data['status'], data)
     assert_equal(3, len(data['history']), data)
-    assert_true(all(doc['data']['type'] == 'query-hive' for doc in data['history']), data)
+    assert_true(all(doc['type'] == 'query-hive' for doc in data['history']), data)
 
     # TODO: test that query history for shared query only returns docs accessible by current user