Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F8322003
test_edit_acme_dns_accounts.sh
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
test_edit_acme_dns_accounts.sh
View Options
#!/usr/bin/env bats
SCRIPT
=
"../roles/paas-docker/letsencrypt/files/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
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 13, 16:57 (1 d, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569443
Default Alt Text
test_edit_acme_dns_accounts.sh (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment