Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def it_records_all_versions_when_no_arguments(config):
expect(gitman.update(depth=1, lock=False)) == True
expect(gitman.lock()) == True
config.datafile.load()
expect(config.datafile.text).contains(
strip(
"""
sources_locked:
def it_should_not_modify_config(config):
gitman.update('gitman_1', depth=1)
expect(config.datafile.text) == CONFIG
- name: gitman_2
type: git
repo: https://github.com/jacebrowning/gitman-demo
sparse_paths:
-
rev: (old revision)
link:
scripts:
-
groups:
-
"""
)
config.datafile.load()
gitman.update(depth=1, force_interactive=True)
expect(config.datafile.text) == strip(
"""
location: deps
rev: example-branch
- name: gitman_2
type: git
repo: https://github.com/jacebrowning/gitman-demo
rev: example-branch
groups:
- name: gitman_1
members:
- gitman_1
- gitman_2
"""
)
config.datafile.load()
with pytest.raises(InvalidConfig):
gitman.update(depth=1, lock=True)
def it_should_fail_on_dirty_repositories(config):
expect(gitman.update(depth=1, lock=False)) == True
shell.rm(os.path.join("deps", "gitman_1", ".project"))
try:
with pytest.raises(UncommittedChanges):
gitman.lock()
expect(config.datafile.text).does_not_contain("")
finally:
shell.rm(os.path.join("deps", "gitman_1"))
def it_records_specified_dependencies(config):
expect(gitman.update(depth=1, lock=False)) == True
expect(gitman.lock('gitman_1', 'gitman_3')) == True
config.datafile.load()
expect(config.datafile.text).contains(
strip(
"""
sources_locked:
- name: gitman_2
type: git
repo: https://github.com/jacebrowning/gitman-demo
sparse_paths:
-
rev: (old revision)
link:
scripts:
-
groups:
-
"""
)
config.datafile.load()
gitman.update(depth=1, lock=False)
expect(config.datafile.text) == strip(
"""
location: deps
- name: gitman_2
type: git
repo: https://github.com/jacebrowning/gitman-demo
sparse_paths:
-
rev: (old revision)
link:
scripts:
-
groups:
-
"""
)
config.datafile.load()
gitman.update(depth=1)
config.datafile.load()
expect(config.datafile.text) == strip(
"""
location: deps
sparse_paths:
-
rev: (old revision)
link:
scripts:
-
groups:
- name: group_a
members:
- gitman_1
- gitman_2
"""
)
config.datafile.load()
gitman.update('group_a', depth=1)
config.datafile.load()
expect(config.datafile.text) == strip(
"""
location: deps