summaryrefslogtreecommitdiff
path: root/testing/tests/server/test__resource.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-03-19 10:48:39 +0100
committerdrebs <drebs@leap.se>2017-04-04 18:27:36 +0200
commit123880b6e524019d25404a85f04a369705a318b8 (patch)
tree3c1d0beebdbf7ef6a3b02877ae55058bcd41d66b /testing/tests/server/test__resource.py
parent36183b7c9daa68ca120ef80767f311faba588cc6 (diff)
[refactor] pass configured blobs resource to server auth class
Diffstat (limited to 'testing/tests/server/test__resource.py')
-rw-r--r--testing/tests/server/test__resource.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/testing/tests/server/test__resource.py b/testing/tests/server/test__resource.py
index c066435e..be02b5a1 100644
--- a/testing/tests/server/test__resource.py
+++ b/testing/tests/server/test__resource.py
@@ -35,22 +35,25 @@ _pool = reactor.getThreadPool()
class SoledadResourceTestCase(unittest.TestCase):
def test_get_root(self):
- enable_blobs = None # doesn't matter
- resource = SoledadResource(enable_blobs=enable_blobs, sync_pool=_pool)
+ blobs_resource = None # doesn't matter
+ resource = SoledadResource(
+ blobs_resource=blobs_resource, sync_pool=_pool)
request = DummyRequest([''])
child = getChildForRequest(resource, request)
self.assertIsInstance(child, ServerInfo)
def test_get_blobs_enabled(self):
- enable_blobs = True
- resource = SoledadResource(enable_blobs=enable_blobs, sync_pool=_pool)
+ blobs_resource = BlobsResource('/tmp')
+ resource = SoledadResource(
+ blobs_resource=blobs_resource, sync_pool=_pool)
request = DummyRequest(['blobs'])
child = getChildForRequest(resource, request)
self.assertIsInstance(child, BlobsResource)
def test_get_blobs_disabled(self):
- enable_blobs = False
- resource = SoledadResource(enable_blobs=enable_blobs, sync_pool=_pool)
+ blobs_resource = None
+ resource = SoledadResource(
+ blobs_resource=blobs_resource, sync_pool=_pool)
request = DummyRequest(['blobs'])
child = getChildForRequest(resource, request)
# if blobs is disabled, the request should be routed to sync
@@ -58,8 +61,9 @@ class SoledadResourceTestCase(unittest.TestCase):
self.assertIsInstance(child._application, GzipMiddleware)
def test_get_sync(self):
- enable_blobs = None # doesn't matter
- resource = SoledadResource(enable_blobs=enable_blobs, sync_pool=_pool)
+ blobs_resource = None # doesn't matter
+ resource = SoledadResource(
+ blobs_resource=blobs_resource, sync_pool=_pool)
request = DummyRequest(['user-db', 'sync-from', 'source-id'])
child = getChildForRequest(resource, request)
self.assertIsInstance(child, WSGIResource)