Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acme-dns-tiny
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Adrien Dorsaz
acme-dns-tiny
Commits
9bb17d13
Commit
9bb17d13
authored
Oct 28, 2018
by
Adrien Dorsaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: adapt tearDown() method for classes so they correctly cleanup temporary files
parent
da5845ac
Pipeline
#219
passed with stage
in 9 minutes and 37 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
12 deletions
+33
-12
tests/test_acme_account_deactivate.py
tests/test_acme_account_deactivate.py
+9
-3
tests/test_acme_account_rollover.py
tests/test_acme_account_rollover.py
+11
-4
tests/test_acme_dns_tiny.py
tests/test_acme_dns_tiny.py
+13
-5
No files found.
tests/test_acme_account_deactivate.py
View file @
9bb17d13
import
unittest
,
os
,
time
import
unittest
,
os
,
time
,
configparser
import
acme_dns_tiny
from
tests.config_factory
import
generate_acme_account_deactivate_config
import
tools.acme_account_deactivate
...
...
@@ -23,8 +23,14 @@ class TestACMEAccountDeactivate(unittest.TestCase):
@
classmethod
def
tearDownClass
(
self
):
# Remove temporary files
os
.
remove
(
self
.
configs
[
'config'
])
os
.
remove
(
self
.
configs
[
'key'
])
parser
=
configparser
.
ConfigParser
()
parser
.
read
(
self
.
configs
[
'config'
])
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
])
os
.
remove
(
parser
[
"acmednstiny"
][
"CSRFile"
])
os
.
remove
(
self
.
configs
[
'config'
])
except
:
pass
super
(
TestACMEAccountDeactivate
,
self
).
tearDownClass
()
def
test_success_account_deactivate
(
self
):
...
...
tests/test_acme_account_rollover.py
View file @
9bb17d13
import
unittest
,
os
,
time
import
unittest
,
os
,
time
,
configparser
import
acme_dns_tiny
from
tests.config_factory
import
generate_acme_account_rollover_config
from
tools.acme_account_deactivate
import
account_deactivate
...
...
@@ -21,9 +21,16 @@ class TestACMEAccountRollover(unittest.TestCase):
# deactivate account key registration at end of tests
# (we assume the key has been roll oved)
account_deactivate
(
self
.
configs
[
"newaccountkey"
],
ACMEDirectory
)
# close temp files correctly
for
tmpfile
in
self
.
configs
:
os
.
remove
(
self
.
configs
[
tmpfile
])
# Remove temporary files
parser
=
configparser
.
ConfigParser
()
parser
.
read
(
self
.
configs
[
'config'
])
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
])
os
.
remove
(
parser
[
"acmednstiny"
][
"CSRFile"
])
os
.
remove
(
self
.
configs
[
"newaccountkey"
])
os
.
remove
(
self
.
configs
[
'config'
])
except
:
pass
super
(
TestACMEAccountRollover
,
self
).
tearDownClass
()
def
test_success_account_rollover
(
self
):
...
...
tests/test_acme_dns_tiny.py
View file @
9bb17d13
import
unittest
,
sys
,
os
,
subprocess
,
time
import
unittest
,
sys
,
os
,
subprocess
,
time
,
configparser
from
io
import
StringIO
import
dns.version
import
acme_dns_tiny
...
...
@@ -22,11 +22,19 @@ class TestACMEDNSTiny(unittest.TestCase):
# To clean ACME staging server and close correctly temporary files
@
classmethod
def
tearDownClass
(
self
):
# deactivate account key registration at end of tests
account_deactivate
(
self
.
configs
[
"accountkey"
],
ACMEDirectory
)
# close temp files correctly
for
tmpfile
in
self
.
configs
:
os
.
remove
(
self
.
configs
[
tmpfile
])
for
conffile
in
self
.
configs
:
parser
=
configparser
.
ConfigParser
()
parser
.
read
(
conffile
)
try
:
os
.
remove
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
])
os
.
remove
(
parser
[
"acmednstiny"
][
"CSRFile"
])
# for each configuraiton, deactivate the account key
if
conffile
!=
"cnameCSR"
:
account_deactivate
(
parser
[
"acmednstiny"
][
"AccountKeyFile"
],
ACMEDirectory
)
os
.
remove
(
conffile
)
except
:
pass
super
(
TestACMEDNSTiny
,
self
).
tearDownClass
()
# helper function to run openssl command
...
...
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