def test_log_error(self):
        with patch(
            "calico_kubernetes.tests.kube_plugin_test." "calico_kubernetes.check_output", autospec=True
        ) as m_check_output:
            # Mock to throw Exception
            m_check_output.side_effect = CalledProcessError

            # Call function, assert Exception is caught.
            _log_interfaces("12345")
    def test_log_interfaces(self, ns):
        with patch(
            "calico_kubernetes.tests.kube_plugin_test." "calico_kubernetes.check_output",
            autospec=True,
            return_value="MOCK_OUTPUT",
        ) as m_check_output:
            _log.info("Testing namespace %s (type=%s)", ns, type(ns))
            _log_interfaces(ns)

            assert_equal(
                m_check_output.mock_calls,
                [
                    call(["ip", "addr"]),
                    call(["ip", "netns", "list"]),
                    # Check we always pass a string to check_output
                    call(["ip", "netns", "exec", str(ns), "ip", "addr"]),
                ],
            )