def _test_eligible_for_deletion_helper(self, prefix, force, is_empty, expected):
        ns = prefix + "6e322ac7-ab50-4f53-9cdc-d1d3c1164b6d"
        conf = mock.Mock()

        with mock.patch("quantum.agent.linux.ip_lib.IPWrapper") as ip_wrap:
            ip_wrap.return_value.namespace_is_empty.return_value = is_empty
            self.assertEqual(util.eligible_for_deletion(conf, ns, force), expected)

            expected_calls = [mock.call(conf.AGENT.root_helper, ns)]
            if not force:
                expected_calls.append(mock.call().namespace_is_empty())
            ip_wrap.assert_has_calls(expected_calls)
    def _test_eligible_for_deletion_helper(self, prefix, force, is_empty,
                                           expected):
        ns = prefix + '6e322ac7-ab50-4f53-9cdc-d1d3c1164b6d'
        conf = mock.Mock()

        with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap:
            ip_wrap.return_value.namespace_is_empty.return_value = is_empty
            self.assertEqual(util.eligible_for_deletion(conf, ns, force),
                             expected)

            expected_calls = [mock.call(conf.AGENT.root_helper, ns)]
            if not force:
                expected_calls.append(mock.call().namespace_is_empty())
            ip_wrap.assert_has_calls(expected_calls)
Exemplo n.º 3
0
 def test_eligible_for_deletion_ns_not_uuid(self):
     ns = 'not_a_uuid'
     self.assertFalse(util.eligible_for_deletion(mock.Mock(), ns))
Exemplo n.º 4
0
 def test_eligible_for_deletion_ns_not_uuid(self):
     ns = 'not_a_uuid'
     self.assertFalse(util.eligible_for_deletion(mock.Mock(), ns))