gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: Fix tests after last changes.


From: gnunet
Subject: [libeufin] branch master updated: Fix tests after last changes.
Date: Mon, 27 Apr 2020 20:30:23 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 8fbb4e5  Fix tests after last changes.
8fbb4e5 is described below

commit 8fbb4e5ae496c0c046552b25bc27fbf91c52eb2c
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Apr 27 20:30:13 2020 +0200

    Fix tests after last changes.
---
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt |  2 +-
 nexus/src/test/kotlin/DbTest.kt                 |  7 ++---
 nexus/src/test/kotlin/PainGeneration.kt         |  6 +---
 nexus/src/test/kotlin/authentication.kt         | 37 ++++++++++++-------------
 4 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index ca1d1da..c10037c 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -216,7 +216,7 @@ object NexusUsersTable : IdTable<String>() {
 
 class NexusUserEntity(id: EntityID<String>) : Entity<String>(id) {
     companion object : EntityClass<String, NexusUserEntity>(NexusUsersTable)
-    var ebicsSubscriber by EbicsSubscriberEntity referencedOn 
NexusUsersTable.ebicsSubscriber
+    var ebicsSubscriber by EbicsSubscriberEntity referencedOn  
NexusUsersTable.ebicsSubscriber
     var password by NexusUsersTable.password
 }
 
diff --git a/nexus/src/test/kotlin/DbTest.kt b/nexus/src/test/kotlin/DbTest.kt
index e89142f..cf4e7c6 100644
--- a/nexus/src/test/kotlin/DbTest.kt
+++ b/nexus/src/test/kotlin/DbTest.kt
@@ -1,13 +1,11 @@
 package tech.libeufin.nexus
 
-import org.jetbrains.exposed.dao.EntityID
 import org.junit.Before
 import org.junit.Test
 
 import org.jetbrains.exposed.sql.Database
 import org.jetbrains.exposed.sql.transactions.transaction
 import org.jetbrains.exposed.sql.SchemaUtils
-import org.joda.time.DateTime
 import tech.libeufin.util.Amount
 import javax.sql.rowset.serial.SerialBlob
 
@@ -24,9 +22,9 @@ class DbTest {
     }
 
     @Test
-    fun makeCustomer() {
+    fun makeEbicsSubscriber() {
         transaction {
-            EbicsSubscriberEntity.new(id = "123asdf-1") {
+            EbicsSubscriberEntity.new {
                 ebicsURL = "ebics url"
                 hostID = "host"
                 partnerID = "partner"
@@ -36,7 +34,6 @@ class DbTest {
                 authenticationPrivateKey = 
SerialBlob("authenticationPrivateKey".toByteArray())
                 encryptionPrivateKey = 
SerialBlob("encryptionPrivateKey".toByteArray())
             }
-            assert(EbicsSubscriberEntity.findById("123asdf-1") != null)
         }
     }
 
diff --git a/nexus/src/test/kotlin/PainGeneration.kt 
b/nexus/src/test/kotlin/PainGeneration.kt
index ad19c76..8f29f45 100644
--- a/nexus/src/test/kotlin/PainGeneration.kt
+++ b/nexus/src/test/kotlin/PainGeneration.kt
@@ -1,9 +1,7 @@
 package tech.libeufin.nexus
 
-import org.jetbrains.exposed.dao.EntityID
 import org.junit.Before
 import org.junit.Test
-
 import org.jetbrains.exposed.sql.Database
 import org.jetbrains.exposed.sql.transactions.transaction
 import org.jetbrains.exposed.sql.SchemaUtils
@@ -22,8 +20,7 @@ class PainTest {
             SchemaUtils.create(EbicsSubscribersTable)
             SchemaUtils.create(BankAccountsTable)
             SchemaUtils.create(Pain001Table)
-
-            val subscriberEntity = EbicsSubscriberEntity.new(id = "123asdf-0") 
{
+            EbicsSubscriberEntity.new {
                 ebicsURL = "ebics url"
                 hostID = "host"
                 partnerID = "partner"
@@ -34,7 +31,6 @@ class PainTest {
                 encryptionPrivateKey = 
SerialBlob("encryptionPrivateKey".toByteArray())
             }
             BankAccountEntity.new(id = "acctid") {
-                subscriber = subscriberEntity
                 accountHolder = "Account Holder"
                 iban = "IBAN"
                 bankCode = "BIC"
diff --git a/nexus/src/test/kotlin/authentication.kt 
b/nexus/src/test/kotlin/authentication.kt
index e4dd3da..2e9c5be 100644
--- a/nexus/src/test/kotlin/authentication.kt
+++ b/nexus/src/test/kotlin/authentication.kt
@@ -10,31 +10,30 @@ import tech.libeufin.util.CryptoUtil
 import javax.sql.rowset.serial.SerialBlob
 
 class AuthenticationTest {
-
     @Test
     fun dbInvolvingTest() {
         Database.connect("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", driver = 
"org.h2.Driver")
         transaction {
-            SchemaUtils.create(EbicsSubscribersTable)
-            EbicsSubscriberEntity.new(id = "username") {
+            SchemaUtils.create(NexusUsersTable)
+            NexusUserEntity.new(id = "username") {
                 password = SerialBlob(CryptoUtil.hashStringSHA256("password"))
-                ebicsURL = "ebics url"
-                hostID = "host"
-                partnerID = "partner"
-                userID = "user"
-                systemID = "system"
-                signaturePrivateKey = 
SerialBlob("signturePrivateKey".toByteArray())
-                authenticationPrivateKey = 
SerialBlob("authenticationPrivateKey".toByteArray())
-                encryptionPrivateKey = 
SerialBlob("encryptionPrivateKey".toByteArray())
+                ebicsSubscriber = EbicsSubscriberEntity.new {
+                    ebicsURL = "ebics url"
+                    hostID = "host"
+                    partnerID = "partner"
+                    userID = "user"
+                    systemID = "system"
+                    signaturePrivateKey = 
SerialBlob("signturePrivateKey".toByteArray())
+                    authenticationPrivateKey = 
SerialBlob("authenticationPrivateKey".toByteArray())
+                    encryptionPrivateKey = 
SerialBlob("encryptionPrivateKey".toByteArray())
+                }
             }
-        }
-        // base64 of "username:password" == "dXNlcm5hbWU6cGFzc3dvcmQ="
-        val (username: String, hashedPass: ByteArray) = 
extractUserAndHashedPassword("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")
-        val result = transaction {
-            val row = EbicsSubscriberEntity.find {
-                EbicsSubscribersTable.id eq username and 
(EbicsSubscribersTable.password eq SerialBlob(hashedPass))
-            }.firstOrNull()
-            assert(row != null)
+            // base64 of "username:password" == "dXNlcm5hbWU6cGFzc3dvcmQ="
+            val (username: String, hashedPass: ByteArray) = 
extractUserAndHashedPassword(
+                "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
+            )
+            val row = NexusUserEntity.findById("username")
+            assert(row?.password == SerialBlob(hashedPass))
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]