Browse Source

Fix broken test logic

pull/7571/head
Andrii Shvaika 4 years ago
parent
commit
7ce3af709b
  1. 2
      application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java
  2. 12
      application/src/test/java/org/thingsboard/server/system/BaseRestApiLimitsTest.java

2
application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java

@ -375,7 +375,7 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
} }
protected void login(String username, String password) throws Exception { protected void login(String username, String password) throws Exception {
logout(); resetTokens();
JsonNode tokenInfo = readResponse(doPost("/api/auth/login", new LoginRequest(username, password)).andExpect(status().isOk()), JsonNode.class); JsonNode tokenInfo = readResponse(doPost("/api/auth/login", new LoginRequest(username, password)).andExpect(status().isOk()), JsonNode.class);
validateAndSetJwtToken(tokenInfo, username); validateAndSetJwtToken(tokenInfo, username);
} }

12
application/src/test/java/org/thingsboard/server/system/BaseRestApiLimitsTest.java

@ -63,15 +63,15 @@ public abstract class BaseRestApiLimitsTest extends AbstractControllerTest {
public void before() throws Exception { public void before() throws Exception {
loginSysAdmin(); loginSysAdmin();
tenantProfile = getDefaultTenantProfile(); tenantProfile = getDefaultTenantProfile();
logout(); resetTokens();
} }
@After @After
public void after() throws Exception { public void after() throws Exception {
logout(); resetTokens();
loginSysAdmin(); loginSysAdmin();
saveTenantProfileWitConfiguration(tenantProfile, new DefaultTenantProfileConfiguration()); saveTenantProfileWitConfiguration(tenantProfile, new DefaultTenantProfileConfiguration());
logout(); resetTokens();
service.shutdown(); service.shutdown();
} }
@ -85,7 +85,7 @@ public abstract class BaseRestApiLimitsTest extends AbstractControllerTest {
saveTenantProfileWitConfiguration(tenantProfile, configurationWithCustomerRestLimits); saveTenantProfileWitConfiguration(tenantProfile, configurationWithCustomerRestLimits);
logout(); resetTokens();
loginCustomerUser(); loginCustomerUser();
@ -105,7 +105,7 @@ public abstract class BaseRestApiLimitsTest extends AbstractControllerTest {
saveTenantProfileWitConfiguration(tenantProfile, configurationWithTenantRestLimits); saveTenantProfileWitConfiguration(tenantProfile, configurationWithTenantRestLimits);
logout(); resetTokens();
loginCustomerUser(); loginCustomerUser();
@ -125,7 +125,7 @@ public abstract class BaseRestApiLimitsTest extends AbstractControllerTest {
saveTenantProfileWitConfiguration(tenantProfile, configurationWithTenantRestLimits); saveTenantProfileWitConfiguration(tenantProfile, configurationWithTenantRestLimits);
logout(); resetTokens();
loginTenantAdmin(); loginTenantAdmin();

Loading…
Cancel
Save