diff --git a/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/V2InvitationControllerTest.kt b/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/V2InvitationControllerTest.kt index 7c437ec5e3..36c939fbda 100644 --- a/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/V2InvitationControllerTest.kt +++ b/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/V2InvitationControllerTest.kt @@ -42,7 +42,6 @@ class V2InvitationControllerTest : AuthorizedControllerTest() { fun `deletes translate invitation with languages`() { val base = dbPopulator.createBase() val project = base.project - tolgeeProperties.frontEndUrl = "https://dummyUrl.com" val invitation = createTranslateInvitation(project) performAuthDelete("/v2/invitations/${invitation.id}").andIsOk @@ -54,7 +53,6 @@ class V2InvitationControllerTest : AuthorizedControllerTest() { fun `project invitation contains creator info`() { val base = dbPopulator.createBase() val project = base.project - tolgeeProperties.frontEndUrl = "https://dummyUrl.com" val invitation = createTranslateInvitation(project) assertThat(invitation.createdBy?.name).isEqualTo("admin") } @@ -62,7 +60,6 @@ class V2InvitationControllerTest : AuthorizedControllerTest() { @Test fun `organization invitation contains creator info`() { val base = dbPopulator.createBase() - tolgeeProperties.frontEndUrl = "https://dummyUrl.com" val invitation = createOrganizationInvitation(base.organization) assertThat(invitation.createdBy?.name).isEqualTo("admin") } @@ -70,7 +67,6 @@ class V2InvitationControllerTest : AuthorizedControllerTest() { @Test fun `deletes invitations created by deleted user`() { val base = dbPopulator.createBase() - tolgeeProperties.frontEndUrl = "https://dummyUrl.com" val newUser = dbPopulator.createUserIfNotExists("manager") permissionService.grantFullAccessToProject(newUser, base.project) diff --git a/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/v2ProjectsController/ProjectsControllerInvitationTest.kt b/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/v2ProjectsController/ProjectsControllerInvitationTest.kt index 4febd1d31a..b16a0dd8b0 100644 --- a/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/v2ProjectsController/ProjectsControllerInvitationTest.kt +++ b/backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/v2ProjectsController/ProjectsControllerInvitationTest.kt @@ -8,13 +8,7 @@ import io.tolgee.development.testDataBuilder.data.BaseTestData import io.tolgee.dtos.misc.CreateProjectInvitationParams import io.tolgee.dtos.request.project.LanguagePermissions import io.tolgee.dtos.request.project.ProjectInviteUserDto -import io.tolgee.fixtures.EmailTestUtil -import io.tolgee.fixtures.andAssertThatJson -import io.tolgee.fixtures.andGetContentAsString -import io.tolgee.fixtures.andHasErrorMessage -import io.tolgee.fixtures.andIsBadRequest -import io.tolgee.fixtures.andIsOk -import io.tolgee.fixtures.node +import io.tolgee.fixtures.* import io.tolgee.model.Invitation import io.tolgee.model.Permission import io.tolgee.model.Project @@ -56,7 +50,6 @@ class ProjectsControllerInvitationTest : ProjectAuthControllerTest("/v2/projects fun `returns project invitations`() { val base = dbPopulator.createBase() val project = base.project - tolgeeProperties.frontEndUrl = "https://dummyUrl.com" createTranslateInvitation(project) performAuthGet("/v2/projects/${project.id}/invitations").andIsOk.andAssertThatJson { node("_embedded.invitations[0]") { diff --git a/backend/app/src/test/kotlin/io/tolgee/controllers/MarketingEmailingTest.kt b/backend/app/src/test/kotlin/io/tolgee/controllers/MarketingEmailingTest.kt index 2d1fbe2213..b7def6152c 100644 --- a/backend/app/src/test/kotlin/io/tolgee/controllers/MarketingEmailingTest.kt +++ b/backend/app/src/test/kotlin/io/tolgee/controllers/MarketingEmailingTest.kt @@ -73,7 +73,6 @@ class MarketingEmailingTest : AuthorizedControllerTest() { @BeforeEach fun setup() { Mockito.clearInvocations(mailjetEmailServiceManager) - tolgeeProperties.frontEndUrl = "https://aaa" tolgeeProperties.smtp.from = "aa@aa.com" emailTestUtil.initMocks() } @@ -98,7 +97,6 @@ class MarketingEmailingTest : AuthorizedControllerTest() { @Test fun `adds contact after verification when needs-verification is on`() { - tolgeeProperties.frontEndUrl = "https://aaa" tolgeeProperties.authentication.needsEmailVerification = true val dto = SignUpDto(name = testName, password = "aaaaaaaaaa", email = testMail) performPost("/api/public/sign_up", dto) diff --git a/backend/app/src/test/kotlin/io/tolgee/controllers/resetPassword/ResetPasswordControllerTest.kt b/backend/app/src/test/kotlin/io/tolgee/controllers/resetPassword/ResetPasswordControllerTest.kt index 817f14ff5e..679c1fd0ff 100644 --- a/backend/app/src/test/kotlin/io/tolgee/controllers/resetPassword/ResetPasswordControllerTest.kt +++ b/backend/app/src/test/kotlin/io/tolgee/controllers/resetPassword/ResetPasswordControllerTest.kt @@ -3,13 +3,13 @@ package io.tolgee.controllers.resetPassword import com.posthog.java.PostHog import io.tolgee.development.testDataBuilder.data.BaseTestData import io.tolgee.dtos.request.auth.ResetPasswordRequest -import io.tolgee.fixtures.* +import io.tolgee.fixtures.EmailTestUtil +import io.tolgee.fixtures.andIsOk import io.tolgee.testing.AbstractControllerTest import io.tolgee.testing.assert import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.mockito.kotlin.times import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc import org.springframework.boot.test.mock.mockito.MockBean @@ -43,7 +43,6 @@ class ResetPasswordControllerTest : @Test fun `email contains correct callback url with frontend url provided`() { - tolgeeProperties.frontEndUrl = "http://dummy-url.com/" executePasswordChangeRequest() emailTestUtil.firstMessageContent.assert.contains("http://dummy-url.com/reset_password/") // We don't want double slashes diff --git a/backend/app/src/test/kotlin/io/tolgee/security/EmailVerificationTest.kt b/backend/app/src/test/kotlin/io/tolgee/security/EmailVerificationTest.kt index 40be051008..1aeb47c238 100644 --- a/backend/app/src/test/kotlin/io/tolgee/security/EmailVerificationTest.kt +++ b/backend/app/src/test/kotlin/io/tolgee/security/EmailVerificationTest.kt @@ -38,7 +38,6 @@ class EmailVerificationTest : AbstractControllerTest() { private fun resetProperties() { tolgeeProperties.authentication.needsEmailVerification = false - tolgeeProperties.frontEndUrl = "dummy_frontend_url" tolgeeProperties.smtp.from = "aaa@aaa.aa" } diff --git a/backend/testing/src/main/kotlin/io/tolgee/AbstractSpringTest.kt b/backend/testing/src/main/kotlin/io/tolgee/AbstractSpringTest.kt index ddf894614d..d855999a27 100644 --- a/backend/testing/src/main/kotlin/io/tolgee/AbstractSpringTest.kt +++ b/backend/testing/src/main/kotlin/io/tolgee/AbstractSpringTest.kt @@ -9,21 +9,11 @@ import io.tolgee.component.machineTranslation.MtServiceManager import io.tolgee.configuration.tolgee.AuthenticationProperties import io.tolgee.configuration.tolgee.InternalProperties import io.tolgee.configuration.tolgee.TolgeeProperties -import io.tolgee.configuration.tolgee.machineTranslation.AwsMachineTranslationProperties -import io.tolgee.configuration.tolgee.machineTranslation.AzureCognitiveTranslationProperties -import io.tolgee.configuration.tolgee.machineTranslation.BaiduMachineTranslationProperties -import io.tolgee.configuration.tolgee.machineTranslation.DeeplMachineTranslationProperties -import io.tolgee.configuration.tolgee.machineTranslation.GoogleMachineTranslationProperties -import io.tolgee.configuration.tolgee.machineTranslation.MachineTranslationProperties -import io.tolgee.configuration.tolgee.machineTranslation.TolgeeMachineTranslationProperties +import io.tolgee.configuration.tolgee.machineTranslation.* import io.tolgee.constants.MtServiceType import io.tolgee.development.DbPopulatorReal import io.tolgee.development.testDataBuilder.TestDataService -import io.tolgee.repository.EmailVerificationRepository -import io.tolgee.repository.KeyRepository -import io.tolgee.repository.OrganizationRepository -import io.tolgee.repository.OrganizationRoleRepository -import io.tolgee.repository.ProjectRepository +import io.tolgee.repository.* import io.tolgee.security.InitialPasswordManager import io.tolgee.service.EmailVerificationService import io.tolgee.service.ImageUploadService @@ -41,12 +31,7 @@ import io.tolgee.service.organization.OrganizationRoleService import io.tolgee.service.organization.OrganizationService import io.tolgee.service.project.LanguageStatsService import io.tolgee.service.project.ProjectService -import io.tolgee.service.security.ApiKeyService -import io.tolgee.service.security.MfaService -import io.tolgee.service.security.PatService -import io.tolgee.service.security.PermissionService -import io.tolgee.service.security.UserAccountService -import io.tolgee.service.security.UserPreferencesService +import io.tolgee.service.security.* import io.tolgee.service.translation.TranslationCommentService import io.tolgee.service.translation.TranslationService import io.tolgee.testing.AbstractTransactionalTest @@ -230,6 +215,11 @@ abstract class AbstractSpringTest : AbstractTransactionalTest() { } } + @BeforeEach + fun setTestingProperties() { + tolgeeProperties.frontEndUrl = "https://dummyFrontEndUrl.com" + } + @Autowired private fun initInitialUser(authenticationProperties: AuthenticationProperties) { initialUsername = authenticationProperties.initialUsername