Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Adrien Dorsaz
acme-dns-tiny
Commits
bc954b24
Commit
bc954b24
authored
Aug 23, 2016
by
Adrien Dorsaz
Browse files
test: add a test to check an error is raised if configuration is not complete
parent
835bb9b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/monkey.py
View file @
bc954b24
...
...
@@ -87,13 +87,19 @@ def gen_configs():
config
[
"acmednstiny"
][
"CSRFile"
]
=
account_csr
.
name
with
open
(
accountAsDomain
.
name
,
'w'
)
as
configfile
:
config
.
write
(
configfile
)
missingDNS
=
NamedTemporaryFile
()
config
[
"DNS"
]
=
{}
with
open
(
missingDNS
.
name
,
'w'
)
as
configfile
:
config
.
write
(
configfile
)
return
{
"goodCName"
:
goodCName
,
"dnsHostIP"
:
dnsHostIP
,
"goodSAN"
:
goodSAN
,
"weakKey"
:
weakKey
,
"accountAsDomain"
:
accountAsDomain
,
"missingDNS"
:
missingDNS
,
"key"
:
{
"accountkey"
:
account_key
,
"weakkey"
:
weak_key
,
"domainkey"
:
domain_key
},
...
...
tests/test_module.py
View file @
bc954b24
...
...
@@ -83,6 +83,14 @@ class TestModule(unittest.TestCase):
self
.
assertIsInstance
(
result
,
ValueError
)
self
.
assertIn
(
"Certificate public key must be different than account key"
,
result
.
args
[
0
])
def
test_failure_notcompleted_configuration
(
self
):
""" Configuration file have to be completed """
try
:
result
=
acme_dns_tiny
.
main
([
CONFIGS
[
'missingDNS'
].
name
])
except
Exception
as
e
:
result
=
e
self
.
assertIsInstance
(
result
,
ValueError
)
self
.
assertIn
(
"Some required settings are missing."
,
result
.
args
[
0
])
if
__name__
==
"__main__"
:
unittest
.
main
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment