Skip to content

Commit

Permalink
x1014 Add integration test for worksCreatedBy query
Browse files Browse the repository at this point in the history
  • Loading branch information
khelwood committed Apr 25, 2023
1 parent 6d92220 commit feb86a2
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
import static uk.ac.sanger.sccp.stan.integrationtest.IntegrationTestUtils.chainGet;
import static uk.ac.sanger.sccp.stan.integrationtest.IntegrationTestUtils.chainGetList;

/**
* Tests work mutation
Expand Down Expand Up @@ -74,6 +75,15 @@ public void testWork() throws Exception {
assertEquals(omero.getName(), chainGet(workData, "omeroProject", "name"));
assertEquals("unstarted", workData.get("status"));

String worksCreatedByQuery = "query { worksCreatedBy(username: \"USER\") { workNumber } }";
data = tester.post(worksCreatedByQuery.replace("USER", enduser.getUsername()));
List<?> createdWorks = chainGet(data, "data", "worksCreatedBy");
assertThat(createdWorks).hasSize(1);
assertEquals(workNumber, chainGet(createdWorks, 0, "workNumber"));

data = tester.post(worksCreatedByQuery.replace("USER", normaluser.getUsername()));
assertThat(chainGetList(data, "data", "worksCreatedBy")).isEmpty();

data = tester.post(worksQuery);
worksData = chainGet(data, "data", "works");
assertEquals(startingNum, worksData.size());
Expand Down

0 comments on commit feb86a2

Please sign in to comment.