commit 3eb59a3e6e9505fd6786310dd4e6eb5810ae7091
parent 7e01743b433fdd67b3c312fe84b1191349e1ee59
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Fri, 17 Apr 2020 17:18:19 +0200
fix test
Diffstat:
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/nexus/src/test/kotlin/authentication.kt b/nexus/src/test/kotlin/authentication.kt
@@ -5,18 +5,14 @@ import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.transactions.transaction
-import org.junit.Before
import org.junit.Test
import tech.libeufin.util.CryptoUtil
-import tech.libeufin.util.toByteArray
-import tech.libeufin.util.toHexString
-import java.sql.Blob
import javax.sql.rowset.serial.SerialBlob
class AuthenticationTest {
- @Before
- fun connectAndMakeTables() {
+ @Test
+ fun dbInvolvingTest() {
Database.connect("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", driver = "org.h2.Driver")
transaction {
SchemaUtils.create(EbicsSubscribersTable)
@@ -32,10 +28,6 @@ class AuthenticationTest {
encryptionPrivateKey = SerialBlob("encryptionPrivateKey".toByteArray())
}
}
- }
-
- @Test
- fun manualMethod() {
// base64 of "username:password" == "dXNlcm5hbWU6cGFzc3dvcmQ="
val (username: String, hashedPass: ByteArray) = extractUserAndHashedPassword("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")
val result = transaction {
@@ -47,7 +39,7 @@ class AuthenticationTest {
}
@Test
- fun testExtractor() {
+ fun basicAuthHeaderTest() {
val (username: String, hashedPass: ByteArray) = extractUserAndHashedPassword("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")
assert(CryptoUtil.hashStringSHA256("password").contentEquals(hashedPass))
}