Add Integration test for follow article routes

This commit is contained in:
2021-02-19 23:30:04 +01:00
parent 8cf79a791e
commit a17bd11e9e
7 changed files with 170 additions and 6 deletions

View File

@@ -15,7 +15,8 @@ fun TestApplicationEngine.`Given I have citizen`(
firstName: String,
lastName: String,
email: String = ("$firstName-$lastName".toLowerCase()) + "@dc-project.fr",
id: String = UUID.randomUUID().toString()
id: String = UUID.randomUUID().toString(),
callback: Citizen.() -> Unit = {}
): Citizen? {
val repo: CitizenRepository by lazy { GlobalContext.get().koin.get() }
@@ -32,7 +33,7 @@ fun TestApplicationEngine.`Given I have citizen`(
user = user
)
return repo.insertWithUser(citizen)
return repo.insertWithUser(citizen)?.also { callback(it) }
}
fun createCitizen(createdByUsername: String? = null): Citizen {