Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodburi
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
zodburi
Commits
37db39b2
Commit
37db39b2
authored
Jul 20, 2016
by
Todd Koym
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing ClientStorage constructor kw args to resolver.
parent
682e8337
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
8 deletions
+62
-8
zodburi/resolvers.py
zodburi/resolvers.py
+5
-4
zodburi/tests/test_resolvers.py
zodburi/tests/test_resolvers.py
+57
-4
No files found.
zodburi/resolvers.py
View file @
37db39b2
...
...
@@ -108,7 +108,7 @@ class FileStorageURIResolver(Resolver):
def
factory
():
filestorage
=
FileStorage
(
*
args
,
**
kw
)
return
BlobStorage
(
blobstorage_dir
,
filestorage
,
layout
=
blobstorage_layout
)
layout
=
blobstorage_layout
)
elif
demostorage
:
def
factory
():
filestorage
=
FileStorage
(
*
args
,
**
kw
)
...
...
@@ -124,10 +124,11 @@ class ClientStorageURIResolver(Resolver):
_int_args
=
(
'debug'
,
'min_disconnect_poll'
,
'max_disconnect_poll'
,
'wait_for_server_on_startup'
,
'wait'
,
'wait_timeout'
,
'read_only'
,
'read_only_fallback'
,
'shared_blob_dir'
,
'demostorage'
)
'demostorage'
,
'drop_cache_rather_verify'
,
'blob_cache_size_check'
)
_string_args
=
(
'storage'
,
'name'
,
'client'
,
'var'
,
'username'
,
'password'
,
'realm'
,
'blob_dir'
)
_bytesize_args
=
(
'cache_size'
,
)
'password'
,
'realm'
,
'blob_dir'
,
'client_label'
)
_bytesize_args
=
(
'cache_size'
,
'blob_cache_size'
)
def
__call__
(
self
,
uri
):
# urlsplit doesnt understand zeo URLs so force to something that
...
...
zodburi/tests/test_resolvers.py
View file @
37db39b2
...
...
@@ -267,12 +267,65 @@ class TestClientStorageURIResolver(unittest.TestCase):
storage
.
close
()
ClientStorage
.
assert_called_once_with
(
'/var/nosuchfile'
,
wait
=
0
)
@
mock
.
patch
(
'zodburi.resolvers.ClientStorage'
)
def
test_factory_kwargs
(
self
,
ClientStorage
):
resolver
=
self
.
_makeOne
()
factory
,
dbkw
=
resolver
(
'zeo:///var/nosuchfile?'
'storage=main&'
'cache_size=1kb&'
'name=foo&'
'client=bar&'
'var=baz&'
'min_disconnect_poll=2&'
'max_disconnect_poll=3&'
'wait_for_server_on_startup=true&'
'wait=4&'
'wait_timeout=5&'
'read_only=6&'
'read_only_fallback=7&'
'drop_cache_rather_verify=true&'
'username=monty&'
'password=python&'
'realm=blat&'
'blob_dir=some/dir&'
'shared_blob_dir=true&'
'blob_cache_size=1kb&'
'blob_cache_size_check=8&'
'client_label=fink&'
)
storage
=
factory
()
storage
.
close
()
ClientStorage
.
assert_called_once_with
(
'/var/nosuchfile'
,
storage
=
'main'
,
cache_size
=
1024
,
name
=
'foo'
,
client
=
'bar'
,
var
=
'baz'
,
min_disconnect_poll
=
2
,
max_disconnect_poll
=
3
,
wait_for_server_on_startup
=
1
,
wait
=
4
,
wait_timeout
=
5
,
read_only
=
6
,
read_only_fallback
=
7
,
drop_cache_rather_verify
=
1
,
username
=
'monty'
,
password
=
'python'
,
realm
=
'blat'
,
blob_dir
=
'some/dir'
,
shared_blob_dir
=
1
,
blob_cache_size
=
1024
,
blob_cache_size_check
=
8
,
client_label
=
'fink'
,
)
@
mock
.
patch
(
'zodburi.resolvers.ClientStorage'
)
def
test_invoke_factory_demostorage
(
self
,
ClientStorage
):
from
ZODB.DemoStorage
import
DemoStorage
resolver
=
self
.
_makeOne
()
factory
,
dbkw
=
resolver
(
'zeo:///var/nosuchfile?wait=false'
'&demostorage=true'
)
'&demostorage=true'
)
storage
=
factory
()
storage
.
close
()
self
.
assertTrue
(
isinstance
(
storage
,
DemoStorage
))
...
...
@@ -280,9 +333,9 @@ class TestClientStorageURIResolver(unittest.TestCase):
def
test_dbargs
(
self
):
resolver
=
self
.
_makeOne
()
factory
,
dbkw
=
resolver
(
'zeo://localhost:8080?debug=true&'
'connection_pool_size=1&'
'connection_cache_size=1&'
'database_name=dbname'
)
'connection_pool_size=1&'
'connection_cache_size=1&'
'database_name=dbname'
)
self
.
assertEqual
(
dbkw
,
{
'connection_pool_size'
:
'1'
,
'connection_cache_size'
:
'1'
,
'database_name'
:
'dbname'
})
...
...
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