Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
eb3a732f
Commit
eb3a732f
authored
Jun 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
04e8a863
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+22
-7
No files found.
wcfs/wcfs_test.py
View file @
eb3a732f
...
@@ -27,6 +27,7 @@ from pytest import raises
...
@@ -27,6 +27,7 @@ from pytest import raises
testdb
=
None
testdb
=
None
testzurl
=
None
testzurl
=
None
testmntpt
=
None
def
setup_module
():
def
setup_module
():
global
testdb
,
testzurl
,
testmntpt
global
testdb
,
testzurl
,
testmntpt
testdb
=
getTestDB
()
testdb
=
getTestDB
()
...
@@ -45,7 +46,7 @@ def teardown_module():
...
@@ -45,7 +46,7 @@ def teardown_module():
def
setup_function
(
f
):
def
setup_function
(
f
):
assert
not
os
.
path
.
exists
(
testmntpt
)
assert
not
os
.
path
.
exists
(
testmntpt
)
# make sure we unmount wcfs after every
function
# make sure we unmount wcfs after every
test
def
teardown_function
(
f
):
def
teardown_function
(
f
):
mounted
=
not
subprocess
.
call
([
"mountpoint"
,
"-q"
,
testmntpt
])
mounted
=
not
subprocess
.
call
([
"mountpoint"
,
"-q"
,
testmntpt
])
if
mounted
:
if
mounted
:
...
@@ -59,24 +60,38 @@ def readfile(path):
...
@@ -59,24 +60,38 @@ def readfile(path):
with
open
(
path
)
as
f
:
with
open
(
path
)
as
f
:
return
f
.
read
()
return
f
.
read
()
# check that zurl does not change from one open to another storage open.
def
test_zurlstable
():
for
i
in
range
(
10
):
zstor
=
testdb
.
getZODBStorage
()
zurl
=
wcfs
.
_zstor_2zurl
(
zstor
)
zstor
.
close
()
assert
zurl
==
testzurl
def
test_join
():
def
test_join
():
zstor
=
testdb
.
getZODBStorage
()
zurl
=
testzurl
zurl
=
wcfs
.
_zstor_2zurl
(
zstor
)
with
raises
(
RuntimeError
,
match
=
"wcfs: join .*: server not started"
):
with
raises
(
RuntimeError
,
match
=
"wcfs: join .*: server not started"
):
wcfs
.
join
(
zurl
,
autostart
=
False
)
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc
=
wcfs
.
_start
(
zurl
)
wc
=
wcfs
.
_start
(
zurl
)
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
assert
wc2
.
mountpoint
==
wc
.
mountpoint
assert
wc2
.
mountpoint
==
wc
.
mountpoint
wc
.
close
()
wc
.
close
()
wc2
.
close
()
wc2
.
close
()
zstor
.
close
()
def
test_join_autostart
():
def
test_join_autostart
():
# XXX
zurl
=
testzurl
pass
with
raises
(
RuntimeError
,
match
=
"wcfs: join .*: server not started"
):
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc
=
wcfs
.
join
(
zurl
,
autostart
=
True
)
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
wc
.
close
()
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