summaryrefslogtreecommitdiffstats
path: root/tests/commands/autoupdate_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/commands/autoupdate_test.py')
-rw-r--r--tests/commands/autoupdate_test.py32
1 files changed, 26 insertions, 6 deletions
diff --git a/tests/commands/autoupdate_test.py b/tests/commands/autoupdate_test.py
index 25161d1..bd89c1d 100644
--- a/tests/commands/autoupdate_test.py
+++ b/tests/commands/autoupdate_test.py
@@ -414,9 +414,9 @@ def test_autoupdate_local_hooks(in_git_dir, store):
config = sample_local_config()
add_config_to_repo('.', config)
assert autoupdate(C.CONFIG_FILE, store, freeze=False, tags_only=False) == 0
- new_config_writen = read_config('.')
- assert len(new_config_writen['repos']) == 1
- assert new_config_writen['repos'][0] == config
+ new_config_written = read_config('.')
+ assert len(new_config_written['repos']) == 1
+ assert new_config_written['repos'][0] == config
def test_autoupdate_local_hooks_with_out_of_date_repo(
@@ -429,9 +429,9 @@ def test_autoupdate_local_hooks_with_out_of_date_repo(
config = {'repos': [local_config, stale_config]}
write_config('.', config)
assert autoupdate(C.CONFIG_FILE, store, freeze=False, tags_only=False) == 0
- new_config_writen = read_config('.')
- assert len(new_config_writen['repos']) == 2
- assert new_config_writen['repos'][0] == local_config
+ new_config_written = read_config('.')
+ assert len(new_config_written['repos']) == 2
+ assert new_config_written['repos'][0] == local_config
def test_autoupdate_meta_hooks(tmpdir, store):
@@ -474,3 +474,23 @@ def test_updates_old_format_to_new_format(tmpdir, capsys, store):
)
out, _ = capsys.readouterr()
assert out == 'Configuration has been migrated.\n'
+
+
+def test_maintains_rev_quoting_style(tmpdir, out_of_date, store):
+ fmt = (
+ 'repos:\n'
+ '- repo: {path}\n'
+ ' rev: "{rev}"\n'
+ ' hooks:\n'
+ ' - id: foo\n'
+ '- repo: {path}\n'
+ " rev: '{rev}'\n"
+ ' hooks:\n'
+ ' - id: foo\n'
+ )
+ cfg = tmpdir.join(C.CONFIG_FILE)
+ cfg.write(fmt.format(path=out_of_date.path, rev=out_of_date.original_rev))
+
+ assert autoupdate(str(cfg), store, freeze=False, tags_only=False) == 0
+ expected = fmt.format(path=out_of_date.path, rev=out_of_date.head_rev)
+ assert cfg.read() == expected