From f4af9ebd9f169a10793f936f2252e625c2eb611a Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Fri, 16 Feb 2024 17:21:45 -0600 Subject: [PATCH] fix cli tests --- tests/integration/testcli.nim | 48 +++++++++++++++-------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/tests/integration/testcli.nim b/tests/integration/testcli.nim index 8e20ba7c..ee0aabe0 100644 --- a/tests/integration/testcli.nim +++ b/tests/integration/testcli.nim @@ -8,9 +8,26 @@ suite "Command line interface": let key = "4242424242424242424242424242424242424242424242424242424242424242" + test "complains when persistence is enabled without ethereum account": + let node = startNode(@[ + "persistence" + ]) + node.waitUntilOutput("Persistence enabled, but no Ethereum account was set") + node.stop() + + test "complains when ethereum private key file has wrong permissions": + let unsafeKeyFile = genTempPath("", "") + discard unsafeKeyFile.writeFile(key, 0o666) + let node = startNode(@[ + "persistence", + "--eth-private-key=" & unsafeKeyFile]) + node.waitUntilOutput("Ethereum private key file does not have safe file permissions") + node.stop() + discard removeFile(unsafeKeyFile) + test "complains when persistence is enabled without accessible r1cs file": - let node = startNode(@["persistence"]) - node.waitUntilOutput("Circom R1CS file not accessible") + let node = startNode(@["persistence", "prover"]) + node.waitUntilOutput("r1cs file not readable, doesn't exist or wrong extension (.r1cs)") node.stop() test "complains when persistence is enabled without accessible wasm file": @@ -19,7 +36,7 @@ suite "Command line interface": "prover", "--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs" ]) - node.waitUntilOutput("Circom wasm file not accessible") + node.waitUntilOutput("wasm file not readable, doesn't exist or wrong extension (.wasm)") node.stop() test "complains when persistence is enabled without accessible zkey file": @@ -31,28 +48,3 @@ suite "Command line interface": ]) node.waitUntilOutput("zkey file not readable, doesn't exist or wrong extension (.zkey)") node.stop() - - test "complains when persistence is enabled without ethereum account": - let node = startNode(@[ - "persistence", - "prover", - "--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs", - "--circom-wasm=tests/circuits/fixtures/proof_main.wasm", - "--circom-zkey=tests/circuits/fixtures/proof_main.zkey" - ]) - node.waitUntilOutput("Persistence enabled, but no Ethereum account was set") - node.stop() - - test "complains when ethereum private key file has wrong permissions": - let unsafeKeyFile = genTempPath("", "") - discard unsafeKeyFile.writeFile(key, 0o666) - let node = startNode(@[ - "persistence", - "prover", - "--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs", - "--circom-wasm=tests/circuits/fixtures/proof_main.wasm", - "--circom-zkey=tests/circuits/fixtures/proof_main.zkey", - "--eth-private-key=" & unsafeKeyFile]) - node.waitUntilOutput("Ethereum private key file does not have safe file permissions") - node.stop() - discard removeFile(unsafeKeyFile)