Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update validation of timestampActivationExpire #568

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,8 @@ public static void activationPrepareExpirationTest(PowerAuthClient powerAuthClie
// Expire activation with 1 hour in the past
final Date expirationTime = Date.from(Instant.now().minus(Duration.ofHours(1)));
initRequest.setTimestampActivationExpire(expirationTime);
InitActivationResponse initResponse = powerAuthClient.initActivation(initRequest);

// Prepare activation
model.setActivationCode(initResponse.getActivationCode());

ObjectStepLogger stepLoggerPrepare = new ObjectStepLogger(System.out);
new PrepareActivationStep().execute(stepLoggerPrepare, model.toMap());
// Verify BAD_REQUEST status code
assertFalse(stepLoggerPrepare.getResult().success());
assertEquals(400, stepLoggerPrepare.getResponse().statusCode());

// Verify error response
ObjectMapper objectMapper = config.getObjectMapper();
final ErrorResponse errorResponse = objectMapper.readValue(stepLoggerPrepare.getResponse().responseObject().toString(), ErrorResponse.class);
assertEquals("ERROR", errorResponse.getStatus());
assertEquals("ERR_ACTIVATION", errorResponse.getResponseObject().getCode());
assertEquals("POWER_AUTH_ACTIVATION_INVALID", errorResponse.getResponseObject().getMessage());
final Exception error = assertThrows(PowerAuthClientException.class, () -> powerAuthClient.initActivation(initRequest));
assertEquals("requestObject.timestampActivationExpire - The activation expiration timestamp must be in the future when initiating activation", error.getMessage());
}

public static void activationPrepareWithoutInitTest(PowerAuthTestConfiguration config, PrepareActivationStepModel model) throws Exception {
Expand Down
Loading