def test_commands(self): config = Config(FILES) shutil.rmtree(config.location, ignore_errors=True) assert not os.path.exists(config.location) # install sources assert gdm.install(root=FILES) assert 'gdm_1' in os.listdir(config.location) assert 'gdm_2' in os.listdir(config.location) # list versions assert gdm.list(FILES) # update sources assert gdm.update(root=FILES) assert 'gdm_1' in os.listdir(config.location) assert 'gdm_2' in os.listdir(config.location) # install locked sources assert gdm.install(root=FILES) assert 'gdm_1' in os.listdir(config.location) assert 'gdm_2' in os.listdir(config.location) # uninstall sources assert gdm.uninstall(root=FILES) assert not os.path.isdir(config.location)
def it_should_lock_all_when_enabled(config): gdm.update(depth=1, lock=True) assert CONFIG + strip(""" sources_locked: - dir: gdm_1 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: eb37743011a398b208dd9f9ef79a408c0fc10d48 - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 - dir: gdm_3 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: 9bf18e16b956041f0267c21baad555a23237b52e """) == config.__mapper__.text
def it_should_not_lock_dependnecies_when_disabled(config): config.__mapper__.text = strip(""" location: deps sources: - dir: gdm_1 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-branch - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-tag sources_locked: - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: (old revision) """) gdm.update(depth=1, lock=False) assert strip(""" location: deps sources: - dir: gdm_1 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-branch - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-tag sources_locked: - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: (old revision) """) == config.__mapper__.text
def it_should_lock_previously_locked_dependnecies(config): config.__mapper__.text = strip(""" location: deps sources: - dir: gdm_1 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-branch - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-tag sources_locked: - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: (old revision) """) gdm.update(depth=1) assert strip(""" location: deps sources: - dir: gdm_1 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-branch - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: example-tag sources_locked: - dir: gdm_2 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: 7bd138fe7359561a8c2ff9d195dff238794ccc04 """) == config.__mapper__.text
def it_should_record_specified_dependencies(config): assert gdm.update(depth=1, lock=False) assert gdm.lock('gdm_1', 'gdm_3') assert CONFIG + strip(""" sources_locked: - dir: gdm_1 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: eb37743011a398b208dd9f9ef79a408c0fc10d48 - dir: gdm_3 link: '' repo: https://github.com/jacebrowning/gdm-demo rev: 9bf18e16b956041f0267c21baad555a23237b52e """) == config.__mapper__.text
def it_should_not_modify_config(config): gdm.update('gdm_1', depth=1) assert CONFIG == config.__mapper__.text