Copilot commented on code in PR #7885:
URL: https://github.com/apache/texera/pull/7885#discussion_r3837966675


##########
file-service/src/test/scala/org/apache/texera/service/resource/DatasetResourceSpec.scala:
##########
@@ -1344,6 +1345,198 @@ class DatasetResourceSpec
     datasetResource.failOnDuplicateDatasetName(42) shouldEqual 42
   }
 
+  // 
===========================================================================
+  // Publicity / downloadable toggles, description, and the public version list
+  // 
===========================================================================
+
+  /** Inserts a dataset owned by `ownerUid`; the DAO fills in the generated 
did. */
+  private def seedDataset(
+      name: String,
+      ownerUid: Integer,
+      isPublic: Boolean = false,
+      isDownloadable: Boolean = false,
+      description: String = "seeded for the toggle tests"
+  ): Dataset = {
+    val dataset = new Dataset
+    dataset.setName(name)
+    dataset.setRepositoryName(s"$name-repo")
+    dataset.setDescription(description)
+    dataset.setOwnerUid(ownerUid)
+    dataset.setIsPublic(isPublic)
+    dataset.setIsDownloadable(isDownloadable)
+    datasetDao.insert(dataset)
+    dataset
+  }
+
+  private def grantAccess(did: Integer, uid: Integer, privilege: 
PrivilegeEnum): Unit = {
+    val access = new DatasetUserAccess
+    access.setDid(did)
+    access.setUid(uid)
+    access.setPrivilege(privilege)
+    new DatasetUserAccessDao(getDSLContext.configuration()).insert(access)
+  }
+
+  private def seedUser(name: String): User = {
+    val user = new User
+    user.setName(name)
+    user.setEmail(s"[email protected]")
+    user.setRole(UserRoleEnum.REGULAR)
+    new UserDao(getDSLContext.configuration()).insert(user)
+    user
+  }
+
+  /**
+    * Creation times are set explicitly because the version list is ordered by 
them and
+    * the column default would stamp every row inserted in one test with the 
same value.
+    */
+  private def seedVersion(did: Integer, name: String, creationTime: 
Timestamp): DatasetVersion = {
+    val version = new DatasetVersion
+    version.setDid(did)
+    version.setCreatorUid(ownerUser.getUid)

Review Comment:
   `seedVersion` hard-codes `creatorUid` to `ownerUser`, but this helper is 
also used to seed versions for datasets owned by other users (e.g., the 
`sibling` dataset below). That makes the fixture inconsistent and could mask 
regressions if version listing or auth logic ever starts depending on the 
creator. Consider deriving the creator from the dataset being seeded (or 
passing it as a parameter).



-- 
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