Mrudhulraj commented on code in PR #6017:
URL: https://github.com/apache/texera/pull/6017#discussion_r3631741356


##########
amber/src/test/scala/org/apache/texera/web/resource/dashboard/file/WorkflowResourceSpec.scala:
##########
@@ -369,6 +372,46 @@ class WorkflowResourceSpec
     assert(DashboardWorkflowEntryList.results.length == 2)
   }
 
+  it should "return only single instance of workflow when owned and shared 
publicly" in {
+    // Set workflow as public
+    testWorkflow1.setIsPublic(true)
+    // Create workflow with testUser as owner
+    workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
+
+    val DashboardWorkflowEntryList =
+      dashboardResource.searchAllResourcesCall(
+        sessionUser1,
+        SearchQueryParams(),
+        includePublic = true
+      )
+    assert(DashboardWorkflowEntryList.results.length == 1)
+    assertSameWorkflow(testWorkflow1, 
DashboardWorkflowEntryList.results.head.workflow.get)
+  }
+
+  it should "return only single instance of workflow when publicly and 
explicitely shared" in {
+    // Set workflow as public
+    testWorkflow1.setIsPublic(true)
+    // Create workflow with testUser as owner
+    val savedWorkflow = workflowResource.persistWorkflow(testWorkflow1, 
sessionUser1)
+    // Share workflow with write acccess to testUser2
+    val workflowAccessResource = new WorkflowAccessResource()
+    workflowAccessResource.grantAccess(
+      savedWorkflow.getWid,
+      testUser2.getEmail,
+      "READ",
+      sessionUser1
+    )
+
+    val DashboardWorkflowEntryList =
+      dashboardResource.searchAllResourcesCall(
+        sessionUser2,
+        SearchQueryParams(),
+        includePublic = true
+      )
+    assert(DashboardWorkflowEntryList.results.length == 1)
+    assertSameWorkflow(savedWorkflow, 
DashboardWorkflowEntryList.results.head.workflow.get)
+  }

Review Comment:
   The workflow is deleted post every testcase. There is no potential leak.
   
   But, will consider it for safety purposes.



##########
amber/src/test/scala/org/apache/texera/web/resource/dashboard/file/WorkflowResourceSpec.scala:
##########
@@ -369,6 +372,46 @@ class WorkflowResourceSpec
     assert(DashboardWorkflowEntryList.results.length == 2)
   }
 
+  it should "return only single instance of workflow when owned and shared 
publicly" in {
+    // Set workflow as public
+    testWorkflow1.setIsPublic(true)
+    // Create workflow with testUser as owner
+    workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
+
+    val DashboardWorkflowEntryList =
+      dashboardResource.searchAllResourcesCall(
+        sessionUser1,
+        SearchQueryParams(),
+        includePublic = true
+      )
+    assert(DashboardWorkflowEntryList.results.length == 1)
+    assertSameWorkflow(testWorkflow1, 
DashboardWorkflowEntryList.results.head.workflow.get)
+  }

Review Comment:
   The workflow is deleted post every testcase. There is no potential leak.
   
   But, will consider it for safety purposes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to