-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from qbicsoftware/patch/security
Enables secured endpoints
- Loading branch information
Showing
4 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,18 @@ class SamplesControllerIntegrationTest { | |
assertEquals(error, "Bad Request") | ||
} | ||
|
||
@Test | ||
void testAuthenticationRequired() throws Exception { | ||
HttpRequest request = HttpRequest.GET("/samples/" + validCode1) | ||
def statusCode | ||
try { | ||
HttpResponse response = client.toBlocking().exchange(request) | ||
} catch (HttpClientResponseException e) { | ||
statusCode = e.getStatus().code | ||
} | ||
assertEquals(401, statusCode) | ||
} | ||
|
||
@Test | ||
void testSample() throws Exception { | ||
String email1 = "[email protected]" | ||
|
@@ -264,7 +276,7 @@ class SamplesControllerIntegrationTest { | |
String body = client.toBlocking().retrieve(request) | ||
assertEquals(body, "Sample status updated.") | ||
|
||
request = HttpRequest.GET("/samples/"+validCode2) | ||
request = HttpRequest.GET("/samples/"+validCode2).basicAuth("servicewriter", "123456!") | ||
body = client.toBlocking().retrieve(request) | ||
JSONObject json = new JSONObject(body); | ||
json = json.get("current_location") | ||
|