mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-01 00:10:12 +01:00
Fixed tests
This commit is contained in:
parent
a7478645bd
commit
243dc0a748
@ -28,7 +28,6 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import utilities.TestConstants;
|
||||
import utilities.mocks.objects.TestRunnableFactory;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
@ -46,9 +45,9 @@ class ActiveCookieStoreTest {
|
||||
when(dbSystem.getDatabase()).thenReturn(db);
|
||||
|
||||
underTest = new ActiveCookieStore(
|
||||
activeCookieExpiryCleanupTask, Mockito.mock(PlanConfig.class),
|
||||
Mockito.mock(ActiveCookieExpiryCleanupTask.class),
|
||||
Mockito.mock(PlanConfig.class),
|
||||
dbSystem,
|
||||
new TestRunnableFactory(),
|
||||
Mockito.mock(Processing.class)
|
||||
);
|
||||
user = new User(TestConstants.PLAYER_ONE_NAME, "console", null, PassEncryptUtil.createHash("testPass"), 0, WebUser.getPermissionsForLevel(0));
|
||||
|
@ -18,6 +18,7 @@ package com.djrapitops.plan.storage.database.queries;
|
||||
|
||||
import com.djrapitops.plan.delivery.domain.WebUser;
|
||||
import com.djrapitops.plan.delivery.domain.auth.User;
|
||||
import com.djrapitops.plan.delivery.webserver.auth.ActiveCookieExpiryCleanupTask;
|
||||
import com.djrapitops.plan.delivery.webserver.auth.ActiveCookieStore;
|
||||
import com.djrapitops.plan.processing.Processing;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
@ -30,7 +31,6 @@ import com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import utilities.TestConstants;
|
||||
import utilities.mocks.objects.TestRunnableFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
@ -78,7 +78,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
|
||||
userIsRegistered();
|
||||
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
|
||||
|
||||
ActiveCookieStore cookieStore = new ActiveCookieStore(activeCookieExpiryCleanupTask, Mockito.mock(PlanConfig.class), dbSystem(), new TestRunnableFactory(), Mockito.mock(Processing.class));
|
||||
ActiveCookieStore cookieStore = createActiveCookieStore();
|
||||
|
||||
String cookie = cookieStore.generateNewCookie(user);
|
||||
|
||||
@ -92,7 +92,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
|
||||
userIsRegistered();
|
||||
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
|
||||
|
||||
ActiveCookieStore cookieStore = new ActiveCookieStore(activeCookieExpiryCleanupTask, Mockito.mock(PlanConfig.class), dbSystem(), new TestRunnableFactory(), Mockito.mock(Processing.class));
|
||||
ActiveCookieStore cookieStore = createActiveCookieStore();
|
||||
|
||||
String cookie = cookieStore.generateNewCookie(user);
|
||||
|
||||
@ -106,7 +106,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
|
||||
userIsRegistered();
|
||||
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
|
||||
|
||||
ActiveCookieStore cookieStore = new ActiveCookieStore(activeCookieExpiryCleanupTask, Mockito.mock(PlanConfig.class), dbSystem(), new TestRunnableFactory(), Mockito.mock(Processing.class));
|
||||
ActiveCookieStore cookieStore = createActiveCookieStore();
|
||||
|
||||
String cookie = cookieStore.generateNewCookie(user);
|
||||
|
||||
@ -117,6 +117,15 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
|
||||
assertTrue(db().query(WebUserQueries.fetchActiveCookies()).isEmpty());
|
||||
}
|
||||
|
||||
private ActiveCookieStore createActiveCookieStore() {
|
||||
return new ActiveCookieStore(
|
||||
Mockito.mock(ActiveCookieExpiryCleanupTask.class),
|
||||
Mockito.mock(PlanConfig.class),
|
||||
dbSystem(),
|
||||
Mockito.mock(Processing.class)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
default void removeEverythingRemovesCookies() {
|
||||
activeCookieStoreSavesCookies();
|
||||
|
Loading…
Reference in New Issue
Block a user