Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Adrien Dorsaz
acme-dns-tiny
Commits
a153485c
Commit
a153485c
authored
May 06, 2019
by
Adrien Dorsaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unit test to check Contacts option is facultative
parent
36aee137
Pipeline
#228
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
tests/config_factory.py
tests/config_factory.py
+11
-0
tests/test_acme_dns_tiny.py
tests/test_acme_dns_tiny.py
+13
-0
No files found.
tests/config_factory.py
View file @
a153485c
...
...
@@ -58,6 +58,16 @@ def generate_acme_dns_tiny_config():
with
open
(
goodCName
.
name
,
'w'
)
as
configfile
:
config
.
write
(
configfile
)
# Simple configuration with good options, without contacts field
account_key
,
domain_key
,
domain_csr
,
config
=
generate_config
();
os
.
remove
(
domain_key
)
config
.
remove_option
(
"acmednstiny"
,
"Contacts"
)
goodCNameWithoutContacts
=
NamedTemporaryFile
(
delete
=
False
)
with
open
(
goodCNameWithoutContacts
.
name
,
'w'
)
as
configfile
:
config
.
write
(
configfile
)
# Simple configuration without CSR in configuration (will be passed as argument)
account_key
,
domain_key
,
domain_csr
,
config
=
generate_config
();
os
.
remove
(
domain_key
)
...
...
@@ -170,6 +180,7 @@ def generate_acme_dns_tiny_config():
return
{
# configs
"goodCName"
:
goodCName
.
name
,
"goodCNameWithoutContacts"
:
goodCNameWithoutContacts
.
name
,
"goodCNameWithoutCSR"
:
goodCNameWithoutCSR
.
name
,
"wildCName"
:
wildCName
.
name
,
"dnsHostIP"
:
dnsHostIP
.
name
,
...
...
tests/test_acme_dns_tiny.py
View file @
a153485c
...
...
@@ -71,6 +71,19 @@ class TestACMEDNSTiny(unittest.TestCase):
self
.
assertCertificateChain
(
certchain
)
def
test_success_cn_without_contacts
(
self
):
""" Successfully issue a certificate via CN, but without Contacts field """
old_stdout
=
sys
.
stdout
sys
.
stdout
=
StringIO
()
acme_dns_tiny
.
main
([
self
.
configs
[
'goodCNameWithoutContacts'
],
"--verbose"
])
certchain
=
sys
.
stdout
.
getvalue
()
sys
.
stdout
.
close
()
sys
.
stdout
=
old_stdout
self
.
assertCertificateChain
(
certchain
)
def
test_success_cn_with_csr_option
(
self
):
""" Successfully issue a certificate using CSR option outside from the config file"""
old_stdout
=
sys
.
stdout
...
...
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