summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-01-26 18:40:18 +0100
committerMS <ms@taler.net>2021-01-26 18:40:18 +0100
commit6159e9fa673cc8b57362b26b6a6343f9cce8a066 (patch)
treee48222184b39f5f12c379f496d57c334bc05d2e0
parentfbf42e3a6d45a224481cb3ca7fa96056554d4469 (diff)
downloadlibeufin-6159e9fa673cc8b57362b26b6a6343f9cce8a066.tar.gz
libeufin-6159e9fa673cc8b57362b26b6a6343f9cce8a066.tar.bz2
libeufin-6159e9fa673cc8b57362b26b6a6343f9cce8a066.zip
test task deletion
-rwxr-xr-xintegration-tests/tests.py57
-rw-r--r--integration-tests/util.py17
2 files changed, 66 insertions, 8 deletions
diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index dec18750..cbc281ee 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -5,7 +5,7 @@ import pytest
import json
from deepdiff import DeepDiff as dd
from subprocess import check_call
-from requests import post, get, auth
+from requests import post, get, auth, delete
from time import sleep
from util import (
startNexus,
@@ -18,7 +18,8 @@ from util import (
LibeufinPersona,
BankingDetails,
NexusDetails,
- EbicsDetails
+ EbicsDetails,
+ compileLibeufin
)
# Database
@@ -116,6 +117,7 @@ def prepareNexus():
)
)
+compileLibeufin()
dropSandboxTables()
startSandbox()
dropNexusTables()
@@ -513,3 +515,54 @@ def test_sandbox_camt():
json=dict(iban="GB33BUKB20201555555555", type=53)
)
)
+
+def test_schedule_deletion():
+ assertResponse(
+ post("/".join([
+ PERSONA.nexus.base_url,
+ "bank-accounts",
+ PERSONA.nexus.bank_label,
+ "schedule"]),
+ json=dict(
+ name="test-task",
+ cronspec="* * *",
+ type="fetch",
+ params=dict(rangeType="all", level="all")),
+ auth=auth.HTTPBasicAuth("admin", "x")
+ )
+ )
+
+ resp = assertResponse(
+ get("/".join([
+ PERSONA.nexus.base_url,
+ "bank-accounts",
+ PERSONA.nexus.bank_label,
+ "schedule",
+ "test-task"]),
+ auth=auth.HTTPBasicAuth("admin", "x")
+ )
+ )
+ assert resp.json().get("taskName") == "test-task"
+
+ assertResponse(
+ delete("/".join([
+ PERSONA.nexus.base_url,
+ "bank-accounts",
+ PERSONA.nexus.bank_label,
+ "schedule",
+ "test-task"]),
+ auth=auth.HTTPBasicAuth("admin", "x")
+ )
+ )
+
+ resp = assertResponse(
+ get("/".join([
+ PERSONA.nexus.base_url,
+ "bank-accounts",
+ PERSONA.nexus.bank_label,
+ "schedule",
+ "test-task"]),
+ auth=auth.HTTPBasicAuth("admin", "x")
+ ),
+ acceptedResponses=[404]
+ )
diff --git a/integration-tests/util.py b/integration-tests/util.py
index 8230a3f8..a05283c6 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -121,6 +121,14 @@ def dropSandboxTables():
])
+def compileLibeufin():
+ check_call([
+ "../gradlew",
+ "-q", "--console=plain",
+ "-p", "..",
+ "assemble"
+ ])
+
def dropNexusTables():
check_call([
"../gradlew",
@@ -130,9 +138,7 @@ def dropNexusTables():
f"--args=reset-tables"
])
-
def startSandbox():
- check_call(["../gradlew", "-q", "--console=plain", "-p", "..", "sandbox:assemble"])
checkPort(5000)
sandbox = Popen([
"../gradlew",
@@ -162,9 +168,6 @@ def startSandbox():
def startNexus():
- check_call(
- ["../gradlew", "-q", "--console=plain", "-p", "..", "nexus:assemble",]
- )
checkPort(5001)
nexus = Popen([
"../gradlew",
@@ -194,7 +197,9 @@ def startNexus():
def assertResponse(r, acceptedResponses=[200]):
def http_trace(r):
- request = f"{r.request.method} {r.request.url}\n{r.request.body.decode('utf-8')}"
+ request = f"{r.request.method} {r.request.url}"
+ if r.request.body:
+ request += f"\n{r.request.body.decode('utf-8')}"
response = f"{r.status_code} {r.reason}\n{r.text}"
return f"(the following communication failed)\n\n{request}\n\n{response}"
assert r.status_code in acceptedResponses, http_trace(r)