EbicsTest.kt (2063B)
1 /* 2 * This file is part of LibEuFin. 3 * Copyright (C) 2025 Taler Systems S.A. 4 5 * LibEuFin is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation; either version 3, or 8 * (at your option) any later version. 9 10 * LibEuFin is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General 13 * Public License for more details. 14 15 * You should have received a copy of the GNU Affero General Public 16 * License along with LibEuFin; see the file COPYING. If not, see 17 * <http://www.gnu.org/licenses/> 18 */ 19 20 import org.w3c.dom.Document 21 import com.github.ajalt.clikt.core.CliktCommand 22 import com.github.ajalt.clikt.testing.test 23 import kotlinx.coroutines.runBlocking 24 import io.ktor.http.* 25 import io.ktor.http.content.* 26 import org.junit.Test 27 import tech.libeufin.ebisync.cli.LibeufinEbisync 28 import tech.libeufin.ebisync.CHECKPOINT_KEY 29 import tech.libeufin.common.* 30 import tech.libeufin.common.test.* 31 import tech.libeufin.common.crypto.CryptoUtil 32 import tech.libeufin.ebics.test.* 33 import tech.libeufin.ebics.* 34 import kotlin.io.path.* 35 import kotlin.test.* 36 import java.time.LocalDate 37 38 @OptIn(kotlin.io.path.ExperimentalPathApi::class) 39 class EbicsTest { 40 private val cmd = LibeufinEbisync() 41 private val bank = EbicsState() 42 private val args = "-L TRACE -c conf/test.conf" 43 44 private fun ebicsSetup() { 45 // Reset current keys 46 val dir = Path("/tmp/ebics-test") 47 dir.deleteRecursively() 48 dir.createDirectories() 49 50 // Set setup mock 51 setMock(sequence { 52 yield(bank::hev) 53 yield(bank::ini) 54 yield(bank::hia) 55 yield(bank::hpb) 56 yield(bank::hkd) 57 yield(bank::receiptOk) 58 }) 59 60 // Run setup 61 cmd.succeed("setup $args --auto-accept-keys") 62 } 63 64 @Test 65 fun setup() { 66 ebicsSetup() 67 } 68 }