Merge "Remove unnecessary open call and related vars in unit tests"

This commit is contained in:
Jenkins 2016-09-06 18:12:40 +00:00 committed by Gerrit Code Review
commit 531a6d46e0
2 changed files with 2 additions and 27 deletions

View File

@ -33,8 +33,7 @@ from swift import __version__ as swift_version
from swift.common.swob import (Request, WsgiBytesIO, HTTPNoContent)
from swift.common import constraints
from swift.account.server import AccountController
from swift.common.utils import (normalize_timestamp, replication, public,
mkdirs, storage_directory)
from swift.common.utils import (normalize_timestamp, replication, public)
from swift.common.request_helpers import get_sys_meta_prefix
from test.unit import patch_policies, debug_logger
from swift.common.storage_policy import StoragePolicy, POLICIES
@ -172,12 +171,6 @@ class TestAccountController(unittest.TestCase):
self.assertEqual(resp.status_int, 507)
def test_REPLICATE_rsync_then_merge_works(self):
mkdirs(os.path.join(self.testdir, 'sda1', 'account', 'p', 'a', 'a'))
db_file = os.path.join(self.testdir, 'sda1',
storage_directory('account', 'p', 'a'),
'a' + '.db')
open(db_file, 'w')
def fake_rsync_then_merge(self, drive, db_file, args):
return HTTPNoContent()
@ -193,12 +186,6 @@ class TestAccountController(unittest.TestCase):
self.assertEqual(resp.status_int, 204)
def test_REPLICATE_complete_rsync_works(self):
mkdirs(os.path.join(self.testdir, 'sda1', 'account', 'p', 'a', 'a'))
db_file = os.path.join(self.testdir, 'sda1',
storage_directory('account', 'p', 'a'),
'a' + '.db')
open(db_file, 'w')
def fake_complete_rsync(self, drive, db_file, args):
return HTTPNoContent()
# check complete_rsync

View File

@ -40,7 +40,7 @@ import swift.container
from swift.container import server as container_server
from swift.common import constraints
from swift.common.utils import (Timestamp, mkdirs, public, replication,
storage_directory, lock_parent_directory)
lock_parent_directory)
from test.unit import fake_http_connect, debug_logger
from swift.common.storage_policy import (POLICIES, StoragePolicy)
from swift.common.request_helpers import get_sys_meta_prefix
@ -1286,12 +1286,6 @@ class TestContainerController(unittest.TestCase):
self.assertEqual(resp.status_int, 507)
def test_REPLICATE_rsync_then_merge_works(self):
mkdirs(os.path.join(self.testdir, 'sda1', 'containers', 'p', 'a', 'a'))
db_file = os.path.join(self.testdir, 'sda1',
storage_directory('containers', 'p', 'a'),
'a' + '.db')
open(db_file, 'w')
def fake_rsync_then_merge(self, drive, db_file, args):
return HTTPNoContent()
@ -1307,12 +1301,6 @@ class TestContainerController(unittest.TestCase):
self.assertEqual(resp.status_int, 204)
def test_REPLICATE_complete_rsync_works(self):
mkdirs(os.path.join(self.testdir, 'sda1', 'containers', 'p', 'a', 'a'))
db_file = os.path.join(self.testdir, 'sda1',
storage_directory('containers', 'p', 'a'),
'a' + '.db')
open(db_file, 'w')
def fake_complete_rsync(self, drive, db_file, args):
return HTTPNoContent()
with mock.patch("swift.container.replicator.ContainerReplicatorRpc."