Пример #1
0
 def setUp(self):
     srv1 = Mock(name="server1")
     srv1.testMethod.return_value = True
     srv2 = Mock(name="server2")
     srv2.testMethod.return_value = False
     self.srvmgr = ServerManager(None)
     self.srvmgr.servers = {"server1": srv1, "server2": srv2}
Пример #2
0
class ServerManagerTest(unittest.TestCase):

    def setUp(self):
        srv1 = Mock(name="server1")
        srv1.testMethod.return_value = True
        srv2 = Mock(name="server2")
        srv2.testMethod.return_value = False
        self.srvmgr = ServerManager(None)
        self.srvmgr.servers = {"server1": srv1, "server2": srv2}

    def test_filter_servers(self):
        filtered = self.srvmgr.filter_servers("testMethod")
        self.assertEqual(filtered, ["server1", ])

    def test_filter_servers_force(self):
        filtered = self.srvmgr.filter_servers("testMethod",
                                              force=("deploy", ))
        self.assertEqual(filtered, ["server1", "server2"])