oleksii-novikov-onix commented on code in PR #5993:
URL: https://github.com/apache/fineract/pull/5993#discussion_r3426577392
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/PasswordPreferencesIntegrationTest.java:
##########
@@ -36,51 +30,34 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@SuppressWarnings({ "rawtypes", "unchecked" })
public class PasswordPreferencesIntegrationTest {
private static final Logger LOG =
LoggerFactory.getLogger(PasswordPreferencesIntegrationTest.class);
- private ResponseSpecification responseSpec;
- private RequestSpecification requestSpec;
- private ResponseSpecification generalResponseSpec;
private int originalPasswordPolicyId;
@BeforeEach
public void setUp() {
Utils.initializeRESTAssured();
- this.requestSpec = new
RequestSpecBuilder().setContentType(ContentType.JSON).build();
- this.requestSpec.header("Authorization", "Basic " +
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
- this.responseSpec = new
ResponseSpecBuilder().expectStatusCode(200).build();
- this.generalResponseSpec = new ResponseSpecBuilder().build();
- originalPasswordPolicyId =
PasswordPreferencesHelper.getActivePasswordPreference(requestSpec,
responseSpec);
+ originalPasswordPolicyId =
PasswordPreferencesHelper.getActivePasswordPreference().getId().intValue();
}
@AfterEach
void tearDown() {
- PasswordPreferencesHelper.updatePasswordPreferences(requestSpec,
responseSpec, Integer.toString(originalPasswordPolicyId));
+
PasswordPreferencesHelper.updatePasswordPreferences(Integer.toString(originalPasswordPolicyId));
}
@Test
public void updatePasswordPreferences() {
String validationPolicyId = "2";
- PasswordPreferencesHelper.updatePasswordPreferences(requestSpec,
responseSpec, validationPolicyId);
- this.validateIfThePasswordIsUpdated(validationPolicyId);
- }
-
- private void validateIfThePasswordIsUpdated(String validationPolicyId) {
- Integer id =
PasswordPreferencesHelper.getActivePasswordPreference(requestSpec,
responseSpec);
+
PasswordPreferencesHelper.updatePasswordPreferences(validationPolicyId);
+ Integer id =
PasswordPreferencesHelper.getActivePasswordPreference().getId().intValue();
assertEquals(validationPolicyId, id.toString());
LOG.info("---------------------------------PASSWORD PREFERENCE
VALIDATED SUCCESSFULLY-----------------------------------------");
-
}
@Test
public void updateWithInvalidPolicyId() {
- String invalidValidationPolicyId = "2000";
- final List<HashMap> error = (List)
PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec,
generalResponseSpec,
- invalidValidationPolicyId, CommonConstants.RESPONSE_ERROR);
- assertEquals("error.msg.password.validation.policy.id.invalid",
error.get(0).get("userMessageGlobalisationCode"),
+ assertThrows(CallFailedRuntimeException.class, () ->
PasswordPreferencesHelper.updatePasswordPreferences("2000"),
"Password Validation Policy with identifier 2000 does not
exist");
Review Comment:
The test has lost the verification for
error.msg.password.validation.policy.id.invalid. It will now pass for any error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]