def test_update_host_and_diff(): conf = SSHConfig(_test_file_path("exhibit_1")) conf.update_host('test-a.us-central1-b.project-name-1', ip="4.4.4.4", id=None) diff = "\n".join(conf.diff()) diff = _RE_ANSI_ESCAPE.sub('', diff) assert "1.11.11" in diff # old ip assert "4.4.4.4" in diff
def test_config_file_load_2(): with open(_test_file_path("exhibit_2"), "r") as f: lines = f.readlines() conf = SSHConfig(f.name) assert len(conf._lines) == len(lines) assert len(conf._hosts) == 1 assert "test_host" in conf._hosts assert not conf.dirty assert not conf.diff()
def test_config_file_load_1(): with open(_test_file_path("exhibit_1"), "r") as f: lines = f.readlines() conf = SSHConfig(f.name) assert len(conf._lines) == len(lines) assert len(conf._hosts) == 2 assert 'test-a.us-central1-b.project-name-1' in conf._hosts assert 'test-b.europe-west4-b.project-name-2' in conf._hosts assert 'defined_before_block' not in conf._hosts assert 'defined_after_block' not in conf._hosts assert not conf.dirty assert not conf.diff()