Move tests and create a command to run all tests
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import feature.KtorServerContext
|
||||
import fr.dcproject.Config
|
||||
import fr.dcproject.Env.CUCUMBER
|
||||
import fr.dcproject.module
|
||||
@@ -10,23 +9,20 @@ import io.cucumber.java8.En
|
||||
import io.cucumber.java8.Scenario
|
||||
import io.cucumber.junit.Cucumber
|
||||
import io.cucumber.junit.CucumberOptions
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.server.testing.withTestApplication
|
||||
import io.ktor.util.KtorExperimentalAPI
|
||||
import io.ktor.server.testing.*
|
||||
import kotlinx.coroutines.InternalCoroutinesApi
|
||||
import org.junit.runner.RunWith
|
||||
import org.koin.test.KoinTest
|
||||
import org.koin.test.get
|
||||
import org.slf4j.Logger
|
||||
import steps.KtorServerContext
|
||||
|
||||
var unitialized: Boolean = false
|
||||
|
||||
@InternalCoroutinesApi
|
||||
@KtorExperimentalAPI
|
||||
@KtorExperimentalLocationsAPI
|
||||
@RunWith(Cucumber::class)
|
||||
@CucumberOptions(plugin = ["pretty"], strict = true)
|
||||
class RunCucumberTest : En, KoinTest {
|
||||
class CucumberTest : En, KoinTest {
|
||||
private val logger: Logger? by LoggerDelegate()
|
||||
|
||||
@InternalCoroutinesApi
|
||||
@@ -1,12 +1,14 @@
|
||||
package functional
|
||||
|
||||
import com.sendgrid.helpers.mail.Mail
|
||||
import com.sendgrid.helpers.mail.objects.Content
|
||||
import com.sendgrid.helpers.mail.objects.Email
|
||||
import fr.dcproject.Env
|
||||
import fr.dcproject.messages.Mailer
|
||||
import fr.dcproject.module
|
||||
import io.ktor.locations.KtorExperimentalLocationsAPI
|
||||
import io.ktor.server.testing.withTestApplication
|
||||
import io.ktor.util.KtorExperimentalAPI
|
||||
import io.ktor.locations.*
|
||||
import io.ktor.server.testing.*
|
||||
import io.ktor.util.*
|
||||
import kotlinx.coroutines.InternalCoroutinesApi
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -21,7 +23,7 @@ import org.koin.test.get
|
||||
class MailerTest : KoinTest, AutoCloseKoinTest() {
|
||||
@InternalCoroutinesApi
|
||||
@Test
|
||||
@Tag("online")
|
||||
@Tag("online, functional")
|
||||
fun `can be send an email`() {
|
||||
withTestApplication({ module(Env.TEST) }) {
|
||||
get<Mailer>().sendEmail {
|
||||
@@ -1,5 +1,6 @@
|
||||
package fr.dcproject.utils
|
||||
package functional
|
||||
|
||||
import fr.dcproject.utils.readResource
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import kotlin.test.assertEquals
|
||||
@@ -1,3 +1,5 @@
|
||||
package functional
|
||||
|
||||
import fr.dcproject.Env
|
||||
import fr.dcproject.component.article.ArticleRefVersioning
|
||||
import fr.dcproject.component.article.ArticleViewManager
|
||||
@@ -7,6 +9,7 @@ import io.ktor.locations.*
|
||||
import io.ktor.server.testing.*
|
||||
import io.ktor.util.*
|
||||
import org.amshove.kluent.`should be equal to`
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
|
||||
@@ -16,6 +19,7 @@ import java.util.*
|
||||
@KtorExperimentalLocationsAPI
|
||||
@KtorExperimentalAPI
|
||||
@TestInstance(PER_CLASS)
|
||||
@Tag("functional")
|
||||
class ViewTest {
|
||||
@Test
|
||||
fun `test View Article`() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import fr.dcproject.component.article.ArticleForUpdate
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import fr.dcproject.component.citizen.Citizen
|
||||
import fr.dcproject.component.citizen.CitizenI
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import fr.dcproject.component.article.ArticleRef
|
||||
import fr.dcproject.component.citizen.Citizen
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import fr.dcproject.component.article.ArticleRef
|
||||
import fr.dcproject.component.citizen.CitizenRepository
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import com.auth0.jwt.JWT
|
||||
import fr.dcproject.JwtConfig
|
||||
@@ -1,10 +1,7 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import io.ktor.application.Application
|
||||
import io.ktor.server.testing.TestApplicationCall
|
||||
import io.ktor.server.testing.TestApplicationEngine
|
||||
import io.ktor.server.testing.TestApplicationRequest
|
||||
import io.ktor.server.testing.createTestEnvironment
|
||||
import io.ktor.application.*
|
||||
import io.ktor.server.testing.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.test.fail
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import com.jayway.jsonpath.JsonPath
|
||||
import io.cucumber.datatable.DataTable
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import io.cucumber.datatable.DataTable
|
||||
import io.cucumber.java8.En
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import fr.dcproject.component.article.ArticleRef
|
||||
import fr.dcproject.component.article.ArticleRepository
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import fr.dcproject.component.article.ArticleRepository
|
||||
import fr.dcproject.component.citizen.CitizenRepository
|
||||
@@ -1,4 +1,4 @@
|
||||
package feature
|
||||
package steps
|
||||
|
||||
import fr.dcproject.component.citizen.Citizen
|
||||
import fr.dcproject.component.citizen.CitizenI
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
import fr.dcproject.component.article.ArticleVoter
|
||||
@@ -17,12 +17,15 @@ import org.joda.time.DateTime
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
import java.util.*
|
||||
import fr.dcproject.component.article.ArticleRepository as ArticleRepo
|
||||
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
class ArticleVoterTest {
|
||||
internal class ArticleVoterTest {
|
||||
private val tesla = CitizenCart(
|
||||
id = UUID.fromString("e6efc288-4283-4729-a268-6debb18de1a0"),
|
||||
user = User(
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.component.citizen.CitizenBasic
|
||||
import fr.dcproject.component.citizen.CitizenI
|
||||
@@ -7,18 +7,19 @@ import fr.dcproject.entity.User
|
||||
import fr.dcproject.entity.UserI
|
||||
import fr.dcproject.voter.Vote.DENIED
|
||||
import fr.dcproject.voter.Vote.GRANTED
|
||||
import io.ktor.locations.*
|
||||
import io.mockk.mockkStatic
|
||||
import org.amshove.kluent.`should be`
|
||||
import org.joda.time.DateTime
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
class CitizenVoterTest {
|
||||
internal class CitizenVoterTest {
|
||||
private val tesla = CitizenBasic(
|
||||
user = User(
|
||||
username = "nicolas-tesla",
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
import fr.dcproject.component.article.ArticleRef
|
||||
@@ -13,7 +13,6 @@ import fr.dcproject.entity.UserI
|
||||
import fr.dcproject.voter.Vote.DENIED
|
||||
import fr.dcproject.voter.Vote.GRANTED
|
||||
import fr.postgresjson.connexion.Paginated
|
||||
import io.ktor.locations.*
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
@@ -22,11 +21,13 @@ import org.joda.time.DateTime
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
import java.util.*
|
||||
import fr.dcproject.component.article.ArticleRepository as ArticleRepo
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
internal class CommentVoterTest {
|
||||
private val tesla = Citizen(
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.citizenOrNull
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
@@ -9,13 +9,13 @@ import fr.dcproject.component.citizen.CitizenI
|
||||
import fr.dcproject.entity.Follow
|
||||
import fr.dcproject.entity.User
|
||||
import fr.dcproject.entity.UserI
|
||||
import fr.dcproject.security.voter.FollowVoter
|
||||
import fr.dcproject.voter.NoSubjectDefinedException
|
||||
import fr.ktorVoter.ActionI
|
||||
import fr.ktorVoter.Vote
|
||||
import fr.ktorVoter.can
|
||||
import fr.ktorVoter.canAll
|
||||
import io.ktor.application.*
|
||||
import io.ktor.locations.*
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
@@ -25,10 +25,12 @@ import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
import java.util.*
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
internal class FollowVoterTest {
|
||||
private val tesla = CitizenBasic(
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
import fr.dcproject.component.citizen.CitizenBasic
|
||||
@@ -7,13 +7,13 @@ import fr.dcproject.component.citizen.CitizenI
|
||||
import fr.dcproject.entity.OpinionChoice
|
||||
import fr.dcproject.entity.User
|
||||
import fr.dcproject.entity.UserI
|
||||
import fr.dcproject.security.voter.OpinionChoiceVoter
|
||||
import fr.dcproject.user
|
||||
import fr.ktorVoter.ActionI
|
||||
import fr.ktorVoter.Vote
|
||||
import fr.ktorVoter.can
|
||||
import fr.ktorVoter.canAll
|
||||
import io.ktor.application.*
|
||||
import io.ktor.locations.*
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
@@ -22,10 +22,12 @@ import org.joda.time.DateTime
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
import java.util.*
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
internal class OpinionChoiceVoterTest {
|
||||
private val tesla = CitizenBasic(
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
import fr.dcproject.component.citizen.CitizenBasic
|
||||
@@ -8,11 +8,11 @@ import fr.dcproject.entity.Opinion
|
||||
import fr.dcproject.entity.OpinionChoice
|
||||
import fr.dcproject.entity.User
|
||||
import fr.dcproject.entity.UserI
|
||||
import fr.dcproject.security.voter.OpinionVoter
|
||||
import fr.dcproject.user
|
||||
import fr.dcproject.voter.NoSubjectDefinedException
|
||||
import fr.ktorVoter.*
|
||||
import io.ktor.application.*
|
||||
import io.ktor.locations.*
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
@@ -22,10 +22,12 @@ import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
import java.util.*
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
internal class OpinionVoterTest {
|
||||
private val tesla = CitizenBasic(
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.citizenOrNull
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
@@ -10,13 +10,13 @@ import fr.dcproject.component.citizen.CitizenI
|
||||
import fr.dcproject.entity.User
|
||||
import fr.dcproject.entity.UserI
|
||||
import fr.dcproject.entity.VoteForUpdate
|
||||
import fr.dcproject.security.voter.VoteVoter
|
||||
import fr.dcproject.voter.NoSubjectDefinedException
|
||||
import fr.ktorVoter.ActionI
|
||||
import fr.ktorVoter.Vote
|
||||
import fr.ktorVoter.can
|
||||
import fr.ktorVoter.canAll
|
||||
import io.ktor.application.*
|
||||
import io.ktor.locations.*
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
@@ -26,11 +26,13 @@ import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
import java.util.*
|
||||
import fr.dcproject.entity.Vote as VoteEntity
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
internal class VoteVoterTest {
|
||||
private val tesla = Citizen(
|
||||
@@ -1,4 +1,4 @@
|
||||
package fr.dcproject.security.voter
|
||||
package unit.voter
|
||||
|
||||
import fr.dcproject.component.article.ArticleForView
|
||||
import fr.dcproject.component.citizen.CitizenBasic
|
||||
@@ -8,6 +8,7 @@ import fr.dcproject.entity.User
|
||||
import fr.dcproject.entity.UserI
|
||||
import fr.dcproject.entity.WorkgroupRef
|
||||
import fr.dcproject.entity.WorkgroupWithMembersI
|
||||
import fr.dcproject.security.voter.WorkgroupVoter
|
||||
import fr.dcproject.user
|
||||
import fr.dcproject.voter.NoSubjectDefinedException
|
||||
import fr.ktorVoter.ActionI
|
||||
@@ -15,18 +16,19 @@ import fr.ktorVoter.Vote
|
||||
import fr.ktorVoter.VoterException
|
||||
import fr.ktorVoter.can
|
||||
import io.ktor.application.*
|
||||
import io.ktor.locations.*
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
import org.amshove.kluent.`should be`
|
||||
import org.joda.time.DateTime
|
||||
import org.junit.jupiter.api.*
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT
|
||||
import java.util.*
|
||||
import fr.dcproject.entity.Workgroup as WorkgroupEntity
|
||||
|
||||
@KtorExperimentalLocationsAPI
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
@Execution(CONCURRENT)
|
||||
@Tag("voter")
|
||||
internal class WorkgroupVoterTest {
|
||||
private val tesla = CitizenBasic(
|
||||
Reference in New Issue
Block a user