소스 검색

Get parent_uuid with the help of uuid from _create_gist response in UT

Harshg999 4 년 전
부모
커밋
db48e91993
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      desktop/core/src/desktop/api2_tests.py

+ 4 - 2
desktop/core/src/desktop/api2_tests.py

@@ -708,15 +708,17 @@ class TestDocumentGist(object):
 
     assert_equal(2, Directory.objects.filter(name=Document2.GIST_DIR, type='directory').count())
 
+    # get_gist_directory merges all duplicate gist directories into one
     response = self._create_gist(
       statement='SELECT 12345',
       doc_type='hive-query',
       name='test_gist_create',
     )
-    gist_parent_dir = Document2.objects.get(type='gist', name='test_gist_create').parent_directory
+    gist_uuid = json.loads(response.content)['uuid']
+    gist_parent_uuid = Document2.objects.get(uuid=gist_uuid).parent_directory.uuid
 
     assert_equal(1, Directory.objects.filter(name=Document2.GIST_DIR, type='directory').count())
-    assert_true(Directory.objects.filter(name=Document2.GIST_DIR, type='directory', uuid=gist_parent_dir.uuid).exists())
+    assert_true(Directory.objects.filter(name=Document2.GIST_DIR, type='directory', uuid=gist_parent_uuid).exists())
 
 
   def test_get(self):