Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kedifa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
kedifa
Commits
85640261
Commit
85640261
authored
Dec 04, 2018
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Use simple capture system
capturer does not work in some of tests environment.
parent
f6a34458
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
kedifa/test.py
kedifa/test.py
+22
-7
setup.py
setup.py
+0
-1
No files found.
kedifa/test.py
View file @
85640261
...
...
@@ -17,7 +17,7 @@
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
import
c
apturer
import
c
ontextlib
import
datetime
import
httplib
import
ipaddress
...
...
@@ -27,6 +27,8 @@ import requests
import
requests.exceptions
import
shutil
import
signal
import
StringIO
import
sys
import
tempfile
import
time
import
unittest
...
...
@@ -45,6 +47,17 @@ from cli import getter
from
cli
import
http
@
contextlib
.
contextmanager
def
captured_output
():
new_out
,
new_err
=
StringIO
.
StringIO
(),
StringIO
.
StringIO
()
old_out
,
old_err
=
sys
.
stdout
,
sys
.
stderr
try
:
sys
.
stdout
,
sys
.
stderr
=
new_out
,
new_err
yield
sys
.
stdout
,
sys
.
stderr
finally
:
sys
.
stdout
,
sys
.
stderr
=
old_out
,
old_err
class
KedifaIntegrationTest
(
unittest
.
TestCase
):
def
createKey
(
self
):
key
=
rsa
.
generate_private_key
(
...
...
@@ -162,16 +175,17 @@ class KedifaIntegrationTest(unittest.TestCase):
self
.
cas
=
cas
.
split
()
kedifa_key_pem
,
csr_file
=
self
.
generateCSR
(
unicode
(
common_name
))
with
capture
r
.
CaptureOutput
()
as
captured
:
with
capture
d_output
()
as
(
out
,
err
)
:
caucase
.
cli
.
main
(
argv
=
self
.
cas
+
[
'--send-csr'
,
csr_file
])
self
.
assertEqual
(
''
,
err
.
getvalue
().
strip
())
output
=
out
.
getvalue
().
strip
()
try
:
csr_id
=
captured
.
get_text
()
.
split
()[
0
]
csr_id
=
output
.
split
()[
0
]
except
IndexError
:
self
.
fail
(
'capturer failed on %s'
%
(
captured
.
get_text
().
split
(),))
self
.
fail
(
'csr_id parse failed: %s'
%
(
output
,))
caucase
.
cli
.
main
(
argv
=
self
.
cas
+
[
'--get-crt'
,
csr_id
,
kedifa_key_pem
])
...
...
@@ -331,12 +345,13 @@ class KedifaIntegrationTest(unittest.TestCase):
self
.
kedifa_url
+
self
.
reference
,
cert
=
incorrect_key_pem
)
def
revokeCaucaseServiceCertifice
(
self
):
with
capture
r
.
CaptureOutput
()
as
captured
:
with
capture
d_output
()
as
(
out
,
err
)
:
caucase
.
cli
.
main
(
argv
=
self
.
cas
+
[
'--revoke-crt'
,
self
.
client_key_pem
,
self
.
client_key_pem
])
self
.
assertEqual
(
''
,
captured
.
get_text
())
self
.
assertEqual
(
''
,
out
.
getvalue
().
strip
())
self
.
assertEqual
(
''
,
err
.
getvalue
().
strip
())
def
test_GET_revoked_identity
(
self
):
self
.
put
()
...
...
setup.py
View file @
85640261
...
...
@@ -21,7 +21,6 @@ from setuptools import setup, find_packages
import
versioneer
tests_require
=
[
'capturer'
,
'urllib3 >= 1.18'
,
# https://github.com/urllib3/urllib3/issues/258
'ipaddress'
,
]
...
...
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