mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
chore: fix tests
This commit is contained in:
parent
e5ad91a61c
commit
b534447f30
@ -5,7 +5,6 @@ import io.papermc.hangar.controller.api.v1.helper.TestData;
|
||||
import io.papermc.hangar.model.common.NamedPermission;
|
||||
import io.papermc.hangar.model.internal.api.requests.CreateAPIKeyForm;
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
@ -14,7 +13,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
class ApiKeysControllerTest extends ControllerTest {
|
||||
|
||||
@Disabled // TODO
|
||||
@Test
|
||||
void testCreateGetDeleteKey() throws Exception {
|
||||
// create
|
||||
|
@ -4,7 +4,6 @@ import io.papermc.hangar.controller.api.v1.helper.ControllerTest;
|
||||
import io.papermc.hangar.controller.api.v1.helper.TestData;
|
||||
import io.papermc.hangar.model.api.project.PageEditForm;
|
||||
import io.papermc.hangar.model.internal.api.requests.StringContent;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
@ -12,7 +11,6 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
@Disabled // TODO
|
||||
class PagesControllerTest extends ControllerTest {
|
||||
|
||||
@Test
|
||||
|
@ -3,6 +3,8 @@ package io.papermc.hangar.controller.api.v1.helper;
|
||||
import io.papermc.hangar.HangarApplication;
|
||||
import io.papermc.hangar.components.auth.model.dto.SignupForm;
|
||||
import io.papermc.hangar.components.auth.service.AuthService;
|
||||
import io.papermc.hangar.components.auth.service.VerificationService;
|
||||
import io.papermc.hangar.db.dao.internal.table.UserDAO;
|
||||
import io.papermc.hangar.model.api.project.ProjectLicense;
|
||||
import io.papermc.hangar.model.api.project.settings.ProjectSettings;
|
||||
import io.papermc.hangar.model.common.NamedPermission;
|
||||
@ -85,6 +87,8 @@ public class TestData {
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private VersionFactory versionFactory;
|
||||
@Autowired
|
||||
private UserDAO userDAO;
|
||||
|
||||
@EventListener(ApplicationStartedEvent.class)
|
||||
public void prepare() {
|
||||
@ -95,6 +99,13 @@ public class TestData {
|
||||
USER_MEMBER = this.authService.registerUser(new SignupForm("TestMember", "testmember@papermc.io", "W45nNUefrsB8ucQeiKDdbEQijH5KP", true));
|
||||
USER_ADMIN = this.authService.registerUser(new SignupForm("TestAdmin", "testadmin@papermc.io", "W45nNUefrsB8ucQeiKDdbEQijH5KP", true));
|
||||
|
||||
USER_NORMAL.setEmailVerified(true);
|
||||
USER_MEMBER.setEmailVerified(true);
|
||||
USER_ADMIN.setEmailVerified(true);
|
||||
this.userDAO.update(USER_NORMAL);
|
||||
this.userDAO.update(USER_MEMBER);
|
||||
this.userDAO.update(USER_ADMIN);
|
||||
|
||||
this.globalRoleService.addRole(new GlobalRoleTable(USER_ADMIN.getUserId(), GlobalRole.HANGAR_ADMIN));
|
||||
|
||||
HangarApplication.TEST_PRINCIPAL = Optional.of(new HangarPrincipal(USER_ADMIN.getUserId(), USER_ADMIN.getName(), USER_ADMIN.getEmail(), false, Permission.All, null, 2, true));
|
||||
|
Loading…
Reference in New Issue
Block a user