def test_dist_resolv_conf_fn(self, m_render_to_file): self.dist.resolve_conf_fn = "/tmp/resolv-test.conf" generate_resolv_conf(self.tmpl_fn, mock.MagicMock(), self.dist.resolve_conf_fn) assert [mock.call(mock.ANY, self.dist.resolve_conf_fn, mock.ANY)] == m_render_to_file.call_args_list
def test_flags_and_options(self, m_write_file, params, expected_extra_line): generate_resolv_conf("templates/resolv.conf.tmpl", params) expected_content = EXPECTED_HEADER if expected_extra_line is not None: # If we have any extra lines, expect a trailing newline expected_content += "\n".join([expected_extra_line, ""]) assert [mock.call(mock.ANY, expected_content, mode=mock.ANY)] == m_write_file.call_args_list
def test_target_fname_is_used_if_passed(self, m_render_to_file): path = "/use/this/path" generate_resolv_conf(self.tmpl_fn, mock.MagicMock(), path) assert [mock.call(mock.ANY, path, mock.ANY)] == m_render_to_file.call_args_list
def test_target_fname_is_used_if_passed(self, m_render_to_file): generate_resolv_conf("templates/resolv.conf.tmpl", mock.MagicMock(), "/use/this/path") assert [mock.call(mock.ANY, "/use/this/path", mock.ANY)] == m_render_to_file.call_args_list
def test_default_target_fname_is_etc_resolvconf(self, m_render_to_file): generate_resolv_conf("templates/resolv.conf.tmpl", mock.MagicMock()) assert [mock.call(mock.ANY, "/etc/resolv.conf", mock.ANY)] == m_render_to_file.call_args_list