# HG changeset patch # User Daniel Dourvaris # Date 2016-07-01 12:21:08 # Node ID 85729415d7815556e4e0bf2adc54bcf37bdb5531 # Parent e35f8ec4eb21564a23c574c9f82bc2912808b9b5 scm: add tests for .mark_for_invalidation(delete=True) diff --git a/rhodecode/tests/models/test_scm.py b/rhodecode/tests/models/test_scm.py --- a/rhodecode/tests/models/test_scm.py +++ b/rhodecode/tests/models/test_scm.py @@ -77,6 +77,19 @@ def test_mark_for_invalidation_config(ba assert kwargs['config'].__dict__ == repo._config.__dict__ +def test_mark_for_invalidation_with_delete_updates_last_commit(backend): + commits = [{'message': 'A'}, {'message': 'B'}] + repo = backend.create_repo(commits=commits) + scm.ScmModel().mark_for_invalidation(repo.repo_name, delete=True) + assert repo.changeset_cache['revision'] == 1 + + +def test_mark_for_invalidation_with_delete_updates_last_commit_empty(backend): + repo = backend.create_repo() + scm.ScmModel().mark_for_invalidation(repo.repo_name, delete=True) + assert repo.changeset_cache['revision'] == -1 + + def test_strip_with_multiple_heads(backend_hg): commits = [ {'message': 'A'},