Fix some tests
This commit is contained in:
committed by
Arnold Gálovics
parent
35cc1fc0d6
commit
25823a9377
+2
-1
@@ -63,7 +63,8 @@ public class ClientAuditingIntegrationTest {
|
||||
public void checkAuditDates() throws InterruptedException {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
String username = Utils.randomNameGenerator("user", 8);
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "resourceId");
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "password",
|
||||
"resourceId");
|
||||
OffsetDateTime now = OffsetDateTime.now(ZoneId.of("Asia/Kolkata"));
|
||||
// Testing in minutes precision, but still need to take care around the end of the actual minute
|
||||
if (now.getSecond() > 56) {
|
||||
|
||||
+2
-1
@@ -75,7 +75,8 @@ public class LoanAuditingIntegrationTest {
|
||||
public void checkAuditDates() throws InterruptedException {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
String username = Utils.randomNameGenerator("user", 8);
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "resourceId");
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "password",
|
||||
"resourceId");
|
||||
|
||||
LOG.info("-------------------------Creating Client---------------------------");
|
||||
|
||||
|
||||
+2
-1
@@ -74,7 +74,8 @@ public class LoanTransactionAuditingIntegrationTest {
|
||||
public void checkAuditDates() throws InterruptedException {
|
||||
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
|
||||
String username = Utils.randomNameGenerator("user", 8);
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "resourceId");
|
||||
final Integer userId = (Integer) UserHelper.createUser(this.requestSpec, this.responseSpec, 1, staffId, username, "password",
|
||||
"resourceId");
|
||||
|
||||
LOG.info("-------------------------Creating Client---------------------------");
|
||||
|
||||
|
||||
+14
-1
@@ -49,6 +49,12 @@ public final class UserHelper {
|
||||
attribute);
|
||||
}
|
||||
|
||||
public static Object createUser(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, int roleId,
|
||||
int staffId, String username, String password, String attribute) {
|
||||
return Utils.performServerPost(requestSpec, responseSpec, CREATE_USER_URL,
|
||||
getTestCreateUserAsJSON(roleId, staffId, username, password), attribute);
|
||||
}
|
||||
|
||||
public static PostUsersResponse createUser(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
PostUsersRequest request) {
|
||||
String requestBody = GSON.toJson(request);
|
||||
@@ -86,7 +92,14 @@ public final class UserHelper {
|
||||
private static String getTestCreateUserAsJSON(int roleId, int staffId, String username) {
|
||||
return "{ \"username\": \"" + username + "\", \"firstname\": \"Test\", \"lastname\": \"User\", \"email\": \"whatever@mifos.org\","
|
||||
+ " \"officeId\": \"1\", \"staffId\": " + "\"" + staffId + "\",\"roles\": [\"" + roleId
|
||||
+ "\"], \"sendPasswordToEmail\": false, \"password\": \"password\"," + " \"repeatPassword\": \"password\"}";
|
||||
+ "\"], \"sendPasswordToEmail\": false}";
|
||||
}
|
||||
|
||||
private static String getTestCreateUserAsJSON(int roleId, int staffId, String username, String password) {
|
||||
return "{ \"username\": \"" + username + "\", \"firstname\": \"Test\", \"lastname\": \"User\", \"email\": \"whatever@mifos.org\","
|
||||
+ " \"officeId\": \"1\", \"staffId\": " + "\"" + staffId + "\",\"roles\": [\"" + roleId
|
||||
+ "\"], \"sendPasswordToEmail\": false, \"password\": \"" + password + "\"," + " \"repeatPassword\": \"" + password
|
||||
+ "\"}";
|
||||
}
|
||||
|
||||
private static String getTestUpdateUserAsJSON(String username) {
|
||||
|
||||
Reference in New Issue
Block a user