[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: fixing tests
From: |
gnunet |
Subject: |
[libeufin] branch master updated: fixing tests |
Date: |
Thu, 03 Sep 2020 14:37:25 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 66a8173 fixing tests
66a8173 is described below
commit 66a817389b41ccc301d11b6da862fa45a7f03c48
Author: MS <ms@taler.net>
AuthorDate: Thu Sep 3 14:36:51 2020 +0200
fixing tests
---
integration-tests/all.sh | 1 +
integration-tests/test-ebics-backup.py | 4 ++--
integration-tests/test-ebics-double-payment-submission.py | 12 +++++-------
integration-tests/util.py | 2 +-
sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt | 6 +++++-
.../kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt | 6 +++---
sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt | 12 ++++++++++++
7 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/integration-tests/all.sh b/integration-tests/all.sh
index 6bbb7ae..c8dd215 100755
--- a/integration-tests/all.sh
+++ b/integration-tests/all.sh
@@ -9,3 +9,4 @@ set -e
./test-taler-facade.py
./test-bankConnection.py
./test-ebics-double-payment-submission.py
+echo "All tests passed."
diff --git a/integration-tests/test-ebics-backup.py
b/integration-tests/test-ebics-backup.py
index 5725c0e..7b4b126 100755
--- a/integration-tests/test-ebics-backup.py
+++ b/integration-tests/test-ebics-backup.py
@@ -153,7 +153,7 @@ print("send ini & hia with restored connection")
assertResponse(
post(
- "http://localhost:5001/bank-connections/my-ebics-restored/send-ini",
+
"http://localhost:5001/bank-connections/my-ebics-restored/ebics/send-ini",
json=dict(),
headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
)
@@ -161,7 +161,7 @@ assertResponse(
assertResponse(
post(
- "http://localhost:5001/bank-connections/my-ebics-restored/send-hia",
+
"http://localhost:5001/bank-connections/my-ebics-restored/ebics/send-hia",
json=dict(),
headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
)
diff --git a/integration-tests/test-ebics-double-payment-submission.py
b/integration-tests/test-ebics-double-payment-submission.py
index de11155..32493a2 100755
--- a/integration-tests/test-ebics-double-payment-submission.py
+++ b/integration-tests/test-ebics-double-payment-submission.py
@@ -45,12 +45,9 @@ def fail(msg):
def assertResponse(response, acceptedResponses=[200]):
if response.status_code not in acceptedResponses:
- print("Test failed on URL: {}".format(response.url))
- # stdout/stderr from both services is A LOT of text.
- # Confusing to dump all that to console.
- print("Check nexus.log and sandbox.log, probably under /tmp")
+ print("Test failed on URL: {}, status: {}/{}".format(
+ response.url, response.status_code, acceptedResponses))
exit(1)
- # Allows for finer grained checks.
return response
startNexus(NEXUS_DB)
@@ -143,6 +140,7 @@ assertResponse(
headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
)
)
+print("First payment done")
# mark the payment as not submitted directly
# into the database.
check_call(["sqlite3", NEXUS_DB, f"UPDATE PaymentInitiations SET submitted =
false WHERE id = '{PREPARED_PAYMENT_UUID}'"])
@@ -154,9 +152,9 @@ assertResponse(
post(
f"http://localhost:5001/bank-accounts/{BANK_ACCOUNT_LABEL}/payment-initiations/{PREPARED_PAYMENT_UUID}/submit",
json=dict(),
- headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
+ headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
),
- [500]
+ acceptedResponses = [500]
)
print("Test passed!")
diff --git a/integration-tests/util.py b/integration-tests/util.py
index fa933e6..129ce0e 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -63,7 +63,7 @@ def startSandbox(dbname="sandbox-test.sqlite3"):
get("http://localhost:5000/")
except:
if i == 9:
- stdout, stderr = nexus.communicate()
+ stdout, stderr = sandbox.communicate()
print("Sandbox timed out")
print("{}\n{}".format(stdout.decode(), stderr.decode()))
exit(77)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index eb98a18..2a34039 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -246,7 +246,7 @@ class EbicsUploadTransactionChunkEntity(id:
EntityID<String>) : Entity<String>(i
/**
* Table that keeps all the payments initiated by PAIN.001.
*/
-object BankAccountTransactionsTable : IntIdTable() {
+object BankAccountTransactionsTable : Table() {
val creditorIban = text("creditorIban")
val creditorBic = text("creditorBic").nullable()
val creditorName = text("creditorName")
@@ -260,8 +260,11 @@ object BankAccountTransactionsTable : IntIdTable() {
val pmtInfId = text("pmtInfId")
val msgId = text("msgId")
val account = reference("account", BankAccountsTable)
+
+ override val primaryKey = PrimaryKey(pmtInfId, msgId)
}
+/*
class BankAccountTransactionsEntity(id: EntityID<Int>) : IntEntity(id) {
companion object :
IntEntityClass<BankAccountTransactionsEntity>(BankAccountTransactionsTable)
@@ -279,6 +282,7 @@ class BankAccountTransactionsEntity(id: EntityID<Int>) :
IntEntity(id) {
var msgId by BankAccountTransactionsTable.msgId
var account by BankAccountEntity referencedOn
BankAccountTransactionsTable.account
}
+*/
/**
* Table that keeps information about which bank accounts (iban+bic+name)
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index a07405d..2996c85 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -572,6 +572,7 @@ private fun handleCct(paymentRequest: String,
initiatorName: String, ctx: Reques
transaction {
try {
BankAccountTransactionsTable.insert {
+ it[account] = getBankAccountFromPain(parseResult).id
it[creditorIban] = parseResult.creditorIban
it[creditorName] = parseResult.creditorName
it[debitorIban] = parseResult.debitorIban
@@ -1069,7 +1070,6 @@ private fun
handleEbicsUploadTransactionTransmission(requestContext: RequestCont
signedData,
requestContext.clientSigPub
)
-
if (!res1) {
throw EbicsInvalidRequestError()
}
@@ -1094,7 +1094,7 @@ private fun
handleEbicsUploadTransactionTransmission(requestContext: RequestCont
}
}
// req.header.static.hostID.
-private fun makeReqestContext(requestObject: EbicsRequest): RequestContext {
+private fun makeRequestContext(requestObject: EbicsRequest): RequestContext {
val staticHeader = requestObject.header.static
val requestedHostId = staticHeader.hostID
val ebicsHost =
@@ -1203,7 +1203,7 @@ suspend fun ApplicationCall.ebicsweb() {
val requestObject = requestDocument.toObject<EbicsRequest>()
val responseXmlStr = transaction {
// Step 1 of 3: Get information about the host and subscriber
- val requestContext = makeReqestContext(requestObject)
+ val requestContext = makeRequestContext(requestObject)
// Step 2 of 3: Validate the signature
val verifyResult =
XMLUtil.verifyEbicsDocument(requestDocument, requestContext.clientAuthPub)
if (!verifyResult) {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
index 3a5b895..9e7040a 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
@@ -38,6 +38,18 @@ fun getOrderTypeFromTransactionId(transactionID: String):
String {
return uploadTransaction.orderType
}
+fun getBankAccountFromPain(painParseResult: PainParseResult):
BankAccountEntity {
+ return transaction {
+ BankAccountEntity.find(
+ BankAccountsTable.iban eq
+ painParseResult.debitorIban
+ )
+ }.firstOrNull() ?: throw SandboxError(
+ HttpStatusCode.NotFound,
+ "Did not find a bank account for ${painParseResult.debitorIban}"
+ )
+}
+
fun getBankAccountFromSubscriber(subscriber: EbicsSubscriberEntity):
BankAccountEntity {
return transaction {
BankAccountEntity.find(BankAccountsTable.subscriber eq subscriber.id)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libeufin] branch master updated: fixing tests,
gnunet <=