Merge "Make test_verify_server independent of test env"
This commit is contained in:
commit
f30455be23
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test.unit import temptree
|
from test.unit import temptree
|
||||||
|
|
||||||
@ -297,6 +298,12 @@ class TestManagerModule(unittest.TestCase):
|
|||||||
("-server", "swift--server"))
|
("-server", "swift--server"))
|
||||||
|
|
||||||
def test_verify_server(self):
|
def test_verify_server(self):
|
||||||
|
def mock_find_exe(f):
|
||||||
|
# pretend that swift-object-server is the only file on path
|
||||||
|
return f if f == 'swift-object-server' else None
|
||||||
|
|
||||||
|
with mock.patch('swift.common.manager.find_executable',
|
||||||
|
side_effect=mock_find_exe):
|
||||||
# test valid servers
|
# test valid servers
|
||||||
self.assertTrue(manager.verify_server('object'))
|
self.assertTrue(manager.verify_server('object'))
|
||||||
self.assertTrue(manager.verify_server('object-server'))
|
self.assertTrue(manager.verify_server('object-server'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user