From 123880b6e524019d25404a85f04a369705a318b8 Mon Sep 17 00:00:00 2001 From: drebs Date: Sun, 19 Mar 2017 10:48:39 +0100 Subject: [refactor] pass configured blobs resource to server auth class --- testing/tests/server/test__resource.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'testing/tests') 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) -- cgit v1.2.3