From f5234eed45d546bf229928a83fc62e027b388a4b Mon Sep 17 00:00:00 2001 From: John Dickinson Date: Sat, 13 Sep 2014 17:39:46 -0700 Subject: [PATCH] a few fixes to tests -- a lot more to be done --- test_slogging/unit/test_db_stats_collector.py | 3 ++- test_slogging/unit/test_internal_proxy.py | 23 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/test_slogging/unit/test_db_stats_collector.py b/test_slogging/unit/test_db_stats_collector.py index 7ba3480..e7c4c2a 100644 --- a/test_slogging/unit/test_db_stats_collector.py +++ b/test_slogging/unit/test_db_stats_collector.py @@ -23,7 +23,8 @@ from shutil import rmtree from slogging import db_stats_collector from tempfile import mkdtemp from test_slogging.unit import FakeLogger -from swift.common.db import AccountBroker, ContainerBroker +from swift.account.backend import AccountBroker +from swift.container.backend import ContainerBroker from swift.common.utils import mkdirs diff --git a/test_slogging/unit/test_internal_proxy.py b/test_slogging/unit/test_internal_proxy.py index 1d4373f..cca5ba8 100644 --- a/test_slogging/unit/test_internal_proxy.py +++ b/test_slogging/unit/test_internal_proxy.py @@ -16,10 +16,11 @@ # TODO: Tests import unittest -import webob import tempfile import json +from swift.common import swob + from slogging import internal_proxy @@ -58,7 +59,7 @@ class DumbApplication(object): body = '' else: body = self.body - resp = webob.Response(request=req, body=body, + resp = swob.Response(request=req, body=body, conditional_response=True) try: resp.status_int = self.status_codes.pop(0) @@ -72,9 +73,9 @@ class DumbApplication(object): class TestInternalProxy(unittest.TestCase): - def test_webob_request_copy(self): - req = webob.Request.blank('/') - req2 = internal_proxy.webob_request_copy(req) + def test_swob_request_copy(self): + req = swob.Request.blank('/') + req2 = internal_proxy.swob_request_copy(req) self.assertEquals(req.path, req2.path) self.assertEquals(req.path_info, req2.path_info) self.assertFalse(req is req2) @@ -86,8 +87,8 @@ class TestInternalProxy(unittest.TestCase): internal_proxy.Application = DumbApplicationFactory( status_codes) p = internal_proxy.InternalProxy() - req = webob.Request.blank('/') - orig_req = internal_proxy.webob_request_copy(req) + req = swob.Request.blank('/') + orig_req = internal_proxy.swob_request_copy(req) resp = p._handle_request(req) self.assertEquals(req.path_info, orig_req.path_info) @@ -96,8 +97,8 @@ class TestInternalProxy(unittest.TestCase): internal_proxy.Application = DumbApplicationFactory( status_codes) p = internal_proxy.InternalProxy(retries=3) - req = webob.Request.blank('/') - orig_req = internal_proxy.webob_request_copy(req) + req = swob.Request.blank('/') + orig_req = internal_proxy.swob_request_copy(req) resp = p._handle_request(req) self.assertEquals(req.path_info, orig_req.path_info) self.assertEquals(p.upload_app.call_count, 2) @@ -126,8 +127,8 @@ class TestInternalProxy(unittest.TestCase): internal_proxy.Application = DumbApplicationFactory( status_codes) p = internal_proxy.InternalProxy(retries=3) - req = webob.Request.blank('/') - orig_req = internal_proxy.webob_request_copy(req) + req = swob.Request.blank('/') + orig_req = internal_proxy.swob_request_copy(req) resp = p._handle_request(req) self.assertEquals(req.path_info, orig_req.path_info) self.assertEquals(p.upload_app.call_count, 3)