Page MenuHomeDevCentral

No OneTemporary

diff --git a/_tests/scripts/bats/test_edit_acme_dns_accounts.sh b/_tests/scripts/bats/test_edit_acme_dns_accounts.sh
index 053a4fe..f17b9bb 100755
--- a/_tests/scripts/bats/test_edit_acme_dns_accounts.sh
+++ b/_tests/scripts/bats/test_edit_acme_dns_accounts.sh
@@ -1,55 +1,55 @@
#!/usr/bin/env bats
-SCRIPT="../roles/core/certificates/files/edit-acme-dns-accounts.py"
+SCRIPT="../roles/core/certificates/files/certbot/acme-dns/edit-acme-dns-accounts.py"
# -------------------------------------------------------------
# Arguments parsing
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@test "exit with error code if no arg provided" {
run $SCRIPT
[ "$status" -ne 0 ]
}
@test "exit with error code if command doesn't exist" {
run $SCRIPT somenonexistingcommand
[ "$status" -ne 0 ]
}
@test "exit with error code if no enough arg" {
run $SCRIPT import
[ "$status" -ne 0 ]
}
# -------------------------------------------------------------
# Import
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@test "can't import a file into itself" {
export ACME_ACCOUNTS=/dev/null
run $SCRIPT import /dev/null
[ "$output" = "You're trying to import /dev/null to itself" ]
[ "$status" -eq 2 ]
}
@test "can merge correctly two credentials files" {
ACME_ACCOUNTS=$(mktemp)
export ACME_ACCOUNTS
cp data/acmedns.json "$ACME_ACCOUNTS"
run $SCRIPT import data/acmedns-toimport.json
[ "$status" -eq 0 ]
isValid=0
run jsondiff "$ACME_ACCOUNTS" data/acmedns-merged.json
rm "$ACME_ACCOUNTS"
[ "$status" -eq 0 ]
[ "$output" = "{}" ] || isValid=1
if [ $isValid -ne 0 ]; then
echo "Non matching part according jsondiff:"
echo "$output"
fi
return $isValid
}
diff --git a/_tests/scripts/python/test_edit_acme_dns_accounts.py b/_tests/scripts/python/test_edit_acme_dns_accounts.py
index b1b9c54..0a72c09 100755
--- a/_tests/scripts/python/test_edit_acme_dns_accounts.py
+++ b/_tests/scripts/python/test_edit_acme_dns_accounts.py
@@ -1,50 +1,50 @@
#!/usr/bin/env python3
import os
import unittest
from helpers import import_from_path
-script_path = "roles/core/certificates/files/edit-acme-dns-accounts.py"
+script_path = "roles/core/certificates/files/certbot/acme-dns/edit-acme-dns-accounts.py"
script = import_from_path("script", script_path)
os.environ["ACME_ACCOUNTS"] = "/path/to/acmedns.json"
class TestInstance(unittest.TestCase):
def setUp(self):
self.testAccounts = script.AcmeAccounts("/dev/null")
pass
def test_read_path_from_environment(self):
self.assertEqual("/path/to/acmedns.json", script.get_acme_accounts_path())
def test_accounts_are_empty_on_init(self):
self.assertEqual({}, self.testAccounts.accounts)
def test_add(self):
self.testAccounts.add("foo.tld", {})
self.assertEqual(1, len(self.testAccounts.accounts))
self.assertIn("foo.tld", self.testAccounts.accounts)
def test_remove_existing(self):
self.testAccounts.add("foo.tld", {})
self.assertTrue(self.testAccounts.remove("foo.tld"))
self.assertEqual(0, len(self.testAccounts.accounts))
def test_remove_non_existing(self):
self.assertFalse(self.testAccounts.remove("not-existing.tld"))
def test_merge(self):
accounts_to_merge = script.AcmeAccounts("/dev/null").add("bar.tld", {})
self.testAccounts.add("foo.tld", {}).merge_with(accounts_to_merge)
self.assertEqual(2, len(self.testAccounts.accounts))
if __name__ == "__main__":
unittest.main()

File Metadata

Mime Type
text/x-diff
Expires
Wed, Mar 18, 13:30 (12 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3540036
Default Alt Text
(3 KB)

Event Timeline