From b9f796b8a213ae1f25a0bbad52be71c23a468ada Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Wed, 14 Dec 2016 12:22:25 +0000 Subject: [PATCH] Remove duplicate setup code from test_tempurl.py TestTempURLPrefix.setUp() almost duplicates the superclass setUp method, except it set "expires" as an instance variable. The duplicated setUp code can be removed by simply having the super class setUp set the "expires" instance variable. Change-Id: Icf7604460e475523e156daa8c578765336820c8e --- test/functional/test_tempurl.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/test/functional/test_tempurl.py b/test/functional/test_tempurl.py index 08b74b6c4c..e8ab11ccca 100644 --- a/test/functional/test_tempurl.py +++ b/test/functional/test_tempurl.py @@ -86,9 +86,9 @@ class TestTempurl(Base): "Expected tempurl_enabled to be True/False, got %r" % (self.env.tempurl_enabled,)) - expires = int(time.time()) + 86400 + self.expires = int(time.time()) + 86400 self.obj_tempurl_parms = self.tempurl_parms( - 'GET', expires, self.env.conn.make_path(self.env.obj.path), + 'GET', self.expires, self.env.conn.make_path(self.env.obj.path), self.env.tempurl_key) def tempurl_parms(self, method, expires, path, key): @@ -298,22 +298,6 @@ class TestTempurl(Base): class TestTempURLPrefix(TestTempurl): - def setUp(self): - super(TestTempurl, self).setUp() - if self.env.tempurl_enabled is False: - raise SkipTest("TempURL not enabled") - elif self.env.tempurl_enabled is not True: - # just some sanity checking - raise Exception( - "Expected tempurl_enabled to be True/False, got %r" % - (self.env.tempurl_enabled,)) - - self.expires = int(time.time()) + 86400 - self.obj_tempurl_parms = self.tempurl_parms( - 'GET', self.expires, - self.env.conn.make_path(self.env.obj.path), - self.env.tempurl_key) - def tempurl_parms(self, method, expires, path, key, prefix=None): path_parts = urllib.parse.unquote(path).split('/')