Fix some tests
This commit is contained in:
committed by
Arnold Gálovics
parent
35cc1fc0d6
commit
25823a9377
+2
-1
@@ -41,9 +41,10 @@ import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
//@Profile("test")
|
||||
@Profile("test")
|
||||
@Component
|
||||
@Path("/internal/client")
|
||||
@RequiredArgsConstructor
|
||||
|
||||
+2
-1
@@ -43,9 +43,10 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
//@Profile("test")
|
||||
@Profile("test")
|
||||
@Component
|
||||
@Path("/internal/loan")
|
||||
@RequiredArgsConstructor
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
|
||||
<changeSet author="fineract" id="1" context="tenant_store_db">
|
||||
<update tableName="tenant_server_connections">
|
||||
<column name="schema_connection_parameters" value="serverTimezone=UTC&useLegacyDatetimeCode=false&sessionVariables=time_zone='+00:00'"/>
|
||||
<column name="schema_connection_parameters" value="serverTimezone=UTC&useLegacyDatetimeCode=false&sessionVariables=time_zone='-00:00'"/>
|
||||
</update>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
||||
+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