Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
caucase
Commits
feb5cae6
Commit
feb5cae6
authored
Dec 18, 2018
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Validate cli.key_id output.
parent
fc3bf97e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
11 deletions
+49
-11
caucase/test.py
caucase/test.py
+49
-11
No files found.
caucase/test.py
View file @
feb5cae6
...
...
@@ -22,6 +22,7 @@ Test suite
"""
# pylint: disable=too-many-lines, too-many-public-methods
from
__future__
import
absolute_import
from
binascii
import
hexlify
import
contextlib
from
Cookie
import
SimpleCookie
import
datetime
...
...
@@ -2236,11 +2237,30 @@ class CaucaseTest(unittest.TestCase):
os
.
unlink
(
self
.
_server_db
)
os
.
unlink
(
self
.
_server_key
)
# XXX: just for the coverage... Should check output
with
captureStdout
()
as
stdout
:
cli
.
key_id
([
'--private-key'
,
user_key_path
,
user2_key_path
,
user2_new_key_path
,
])
key_id_dict
=
dict
(
line
.
rsplit
(
' '
,
1
)
for
line
in
stdout
.
getvalue
().
splitlines
()
)
key_id
=
key_id_dict
.
pop
(
user_key_path
)
key2_id
=
key_id_dict
.
pop
(
user2_key_path
)
new_key2_id
=
key_id_dict
.
pop
(
user2_new_key_path
)
self
.
assertFalse
(
key_id_dict
)
with
captureStdout
()
as
stdout
:
cli
.
key_id
([
'--private-key'
,
user_key_path
,
user2_key_path
,
'--backup'
,
backup_path
,
])
self
.
assertItemsEqual
(
[
backup_path
,
' '
+
key_id
,
' '
+
key2_id
,
],
stdout
.
getvalue
().
splitlines
(),
)
self
.
assertEqual
(
self
.
_restoreServer
(
...
...
@@ -2321,9 +2341,18 @@ class CaucaseTest(unittest.TestCase):
if
not
backup_path_list
:
# pragma: no cover
raise
AssertionError
(
'Backup file not created after 1 second'
)
backup_path
,
=
glob
.
glob
(
backup_glob
)
with
captureStdout
()
as
stdout
:
cli
.
key_id
([
'--backup'
,
backup_path
,
])
self
.
assertItemsEqual
(
[
backup_path
,
' '
+
key_id
,
' '
+
new_key2_id
,
],
stdout
.
getvalue
().
splitlines
(),
)
# Now, push a lot of data to exercise chunked checksum in backup &
# restoration code
...
...
@@ -2346,9 +2375,18 @@ class CaucaseTest(unittest.TestCase):
if
not
backup_path_list
:
# pragma: no cover
raise
AssertionError
(
'Backup file took too long to be created'
)
backup_path
,
=
glob
.
glob
(
backup_glob
)
with
captureStdout
()
as
stdout
:
cli
.
key_id
([
'--backup'
,
backup_path
,
])
self
.
assertItemsEqual
(
[
backup_path
,
' '
+
key_id
,
' '
+
new_key2_id
,
],
stdout
.
getvalue
().
splitlines
(),
)
self
.
_stopServer
()
os
.
unlink
(
self
.
_server_db
)
os
.
unlink
(
self
.
_server_key
)
...
...
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