-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...halla/core/dal/service/project/Project.kt → .../dal/service/project/ProjectDataAccess.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
package org.akrck02.valhalla.core.dal.service.project | ||
|
||
class UserDataAccessTest |
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
src/test/kotlin/org/akrck02/valhalla/core/dal/service/user/UserDataAccessTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.akrck02.valhalla.core.dal.service.user | ||
|
||
import com.mongodb.kotlin.client.coroutine.MongoDatabase | ||
import kotlinx.coroutines.launch | ||
import kotlinx.coroutines.runBlocking | ||
import org.akrck02.valhalla.core.dal.configuration.getCurrentDatabaseConfiguration | ||
import org.akrck02.valhalla.core.dal.database.Databases | ||
import org.akrck02.valhalla.core.dal.database.Mongo | ||
import org.akrck02.valhalla.core.sdk.model.exception.ServiceException | ||
import org.akrck02.valhalla.core.sdk.model.user.User | ||
import org.junit.jupiter.api.BeforeEach | ||
import kotlin.test.Test | ||
|
||
class UserDataAccessTest { | ||
|
||
@BeforeEach | ||
fun resetDatabase() { | ||
runBlocking { | ||
val mongo = Mongo().also { it.connect(getCurrentDatabaseConfiguration()) } | ||
val database: MongoDatabase? = mongo.client?.getDatabase(databaseName = Databases.ValhallaTest.id) | ||
database ?: throw ServiceException(message = "Cannot connect to database") | ||
} | ||
} | ||
|
||
@Test | ||
fun userRegisterTest() { | ||
runBlocking { | ||
val mongo = Mongo().also { it.connect(getCurrentDatabaseConfiguration()) } | ||
val database: MongoDatabase? = mongo.client?.getDatabase(databaseName = Databases.ValhallaTest.id) | ||
launch { | ||
database ?: throw ServiceException(message = "Database not connected!") | ||
registerUser( | ||
database, | ||
User( | ||
id = null, | ||
username = "akrck01", | ||
email = "akrck02@gmail.com", | ||
password = "#PasswordisHereLoL#?" | ||
) | ||
) | ||
} | ||
|
||
} | ||
} | ||
} |