Example #1
0
 def test_veth_exists_true(self, m_check_call, m_open):
     """
     Test veth_exists returns True if no error occurs.
     """
     self.assertTrue(veth_exists("veth1"))
     m_open.assert_called_once_with(os.devnull, "w")
     m_check_call.assert_called_once_with(["ip", "link", "show", "veth1"], stderr=ANY, stdout=ANY)
Example #2
0
 def test_veth_exists_false(self, m_check_call, m_open):
     """
     Test veth_exists returns False if an error occurs.
     """
     m_check_call.side_effect = CalledProcessError(1, "test")
     self.assertFalse(veth_exists("veth1"))
     m_open.assert_called_once_with(os.devnull, "w")
     m_check_call.assert_called_once_with(["ip", "link", "show", "veth1"], stderr=ANY, stdout=ANY)
Example #3
0
 def test_veth_exists_true(self, m_check_call, m_open):
     """
     Test veth_exists returns True if no error occurs.
     """
     self.assertTrue(veth_exists("veth1"))
     m_open.assert_called_once_with(os.devnull, 'w')
     m_check_call.assert_called_once_with(["ip", "link", "show", "veth1"],
                                          stderr=ANY,
                                          stdout=ANY)
Example #4
0
 def test_veth_exists_false(self, m_check_call, m_open):
     """
     Test veth_exists returns True if no error occurs.
     """
     m_check_call.side_effect = CalledProcessError(1, "test")
     self.assertFalse(veth_exists("veth1"))
     m_open.assert_called_once_with(os.devnull, 'w')
     m_check_call.assert_called_once_with(["ip", "link", "show", "veth1"],
                                          stderr=ANY,
                                          stdout=ANY)