diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-06-14 09:11:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-06-14 09:11:21 +0000 |
commit | cc9f06b22c7665893e6958f7518a9e8d258e7d98 (patch) | |
tree | 19c3ef54ef886a32df2f3ed7be2f694d77b50bfc /tests/commands/autoupdate_test.py | |
parent | Adding upstream version 2.3.0. (diff) | |
download | pre-commit-cc9f06b22c7665893e6958f7518a9e8d258e7d98.tar.xz pre-commit-cc9f06b22c7665893e6958f7518a9e8d258e7d98.zip |
Adding upstream version 2.5.1.upstream/2.5.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/commands/autoupdate_test.py')
-rw-r--r-- | tests/commands/autoupdate_test.py | 32 |
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 |