Skip to content

Commit

Permalink
ZooniverseClient: Retrieve workload by ID
Browse files Browse the repository at this point in the history
  • Loading branch information
murraycu committed Jan 10, 2019
1 parent 4df0f9d commit 42eed17
Show file tree
Hide file tree
Showing 4 changed files with 484 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
public class ZooniverseClientTest{

private static final String TEST_GROUP_ID = "5853fab395ad361930000003";
public static final String TEST_WORKFLOW_ID = "6122";

@Before
public void setUp() throws IOException {
Expand Down Expand Up @@ -165,6 +166,37 @@ public void testProject() throws IOException, ZooniverseClient.RequestProjectExc
server.shutdown();
}

@Test
public void testWorkflow() throws IOException, ZooniverseClient.RequestWorkflowException {
final MockWebServer server = new MockWebServer();

final String strResponse = getStringFromStream(
MoreItemsJsonParserTest.class.getClassLoader().getResourceAsStream("test_workflow_response.json"));
assertNotNull(strResponse);
server.enqueue(new MockResponse().setBody(strResponse));
server.start();

final ZooniverseClient client = createZooniverseClient(server);

final ZooniverseClient.Workflow workflow = client.requestWorkflowSync(TEST_WORKFLOW_ID);
assertNotNull(workflow);

assertNotNull(workflow.id());
assertEquals(TEST_WORKFLOW_ID, workflow.id());

assertNotNull(workflow.displayName());
assertEquals("DECaLS DR5", workflow.displayName());

final List<ZooniverseClient.Task> tasks = workflow.tasks();
assertNotNull(tasks);
assertEquals(11, tasks.size());

assertEquals("T0", tasks.get(0).id());
assertEquals("T1", tasks.get(1).id());

server.shutdown();
}

@Test
public void testLoginWithSuccess() throws IOException, InterruptedException, ZooniverseClient.LoginException {
final MockWebServer server = new MockWebServer();
Expand Down
Loading

0 comments on commit 42eed17

Please sign in to comment.