Skip to content

Commit

Permalink
Extracting repeated url string, refining assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers committed Apr 7, 2015
1 parent 7b4bf67 commit 3fa5a9c
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -18,12 +18,13 @@
@RequiresVersion(">=1.1.0")
public class AgentsTest extends BaseRestTest {
private final String resourcePrefix = "/system/agents";
private final String resourceEndpoint = resourcePrefix + "/register";

@Test
public void testRegisterAgent() throws Exception {
given().when()
.body(jsonResourceForMethod())
.post(resourcePrefix + "/register")
.post(resourceEndpoint)
.then()
.statusCode(202);
}
Expand All @@ -32,7 +33,7 @@ public void testRegisterAgent() throws Exception {
public void testRegisterInvalidAgent() throws Exception {
given().when()
.body(jsonResourceForMethod())
.post(resourcePrefix + "/register")
.post(resourceEndpoint)
.then()
.statusCode(400);
}
Expand All @@ -50,7 +51,7 @@ public void testListAgents() throws Exception {
public void testGetAgent() throws Exception {
given().when()
.body(jsonResourceForMethod())
.post(resourcePrefix + "/register")
.post(resourceEndpoint)
.then()
.statusCode(202);

Expand All @@ -60,13 +61,13 @@ public void testGetAgent() throws Exception {
.statusCode(200)
.assertThat()
.body("id", is("getAgentTest"))
.body(".", containsAllKeys("id", "node_id", "node_details", "last_seen"));
.body(".", containsAllKeys("id", "node_id", "node_details", "last_seen", "active"))
.body("active", is(true));
}

@Test
public void testTouchAgent() throws Exception {
final String agentId = "testTouchAgentId";
final String resourceEndpoint = resourcePrefix + "/register";

given().when()
.body(jsonResourceForMethod())
Expand Down

0 comments on commit 3fa5a9c

Please sign in to comment.