Skip to content

Commit 0fd2aee

Browse files
Update TestValidateCheck.java (#40)
add testLostValues()
1 parent 0eddc44 commit 0fd2aee

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/test/java/org/privacyidea/TestValidateCheck.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,33 @@ public void testOTPSuccess()
8080
assertTrue(response.value);
8181
}
8282

83+
@Test
84+
public void testLostValues()
85+
{
86+
String responseBody =
87+
"{\n" + " \"detail\": {\n" +
88+
" \"threadid\": 140536383567616,\n" +
89+
" \"result\": {\n" + " \"status\": true,\n" + " \"value\": true\n" + " },\n" +
90+
" \"time\": 1589276995.4397042,\n" + " \"version\": \"privacyIDEA None\",\n" +
91+
"}";
92+
93+
mockServer.when(HttpRequest.request().withMethod("POST").withPath("/validate/check")
94+
.withBody("user=" + username + "&pass=" + otp)).respond(
95+
HttpResponse.response().withContentType(MediaType.APPLICATION_JSON).withBody(responseBody)
96+
.withDelay(TimeUnit.MILLISECONDS, 50));
97+
98+
PIResponse response = privacyIDEA.validateCheck(username, otp);
99+
100+
assertEquals("", response.piVersion);
101+
assertEquals("", response.message);
102+
assertEquals(0, response.otpLength);
103+
assertEquals(0, response.id);
104+
assertEquals("", response.jsonRPCVersion);
105+
assertEquals("", response.serial);
106+
assertEquals("", response.type);
107+
assertEquals("", response.signature);
108+
}
109+
83110
@Test
84111
public void testEmptyResponse()
85112
{

0 commit comments

Comments
 (0)