def test_remove_entry_where__with_kwargs(kwargs, expected, tmpfile): tmpfile.write_text(TEST_HOSTS_CONTENT) hosts_editor = HostsEditor(str(tmpfile), False) hosts_editor.remove_entry_where(**kwargs) assert expected == hosts_editor.read_raw()
def test_remove_entry_where__without_kwargs(tmpfile): """Suppose to remove every entry""" tmpfile.write_text(TEST_HOSTS_CONTENT) hosts_editor = HostsEditor(str(tmpfile), create_backup=False) hosts_editor.remove_entry_where() assert TEST_HOSTS_CONTENT_NO_DATA == hosts_editor.read_raw()