1 from __future__
import absolute_import
, division
, print_function
, unicode_literals
3 # pylint: disable=redefined-outer-name
4 from cola
.models
.stash
import StashModel
7 from .helper
import app_context
10 # These assertions make flake8 happy. It considers them unused imports otherwise.
11 assert app_context
is not None
14 def test_stash_info_for_message_without_slash(app_context
):
16 helper
.write_file('A', 'change')
17 helper
.run_git('stash', 'save', 'some message')
18 assert StashModel(app_context
).stash_info()[0] == [
19 r
'stash@{0}: On main: some message'
23 def test_stash_info_for_message_with_slash(app_context
):
25 helper
.write_file('A', 'change')
26 helper
.run_git('stash', 'save', 'some message/something')
27 model
= StashModel(app_context
)
28 stash_details
= model
.stash_info()[0]
29 assert stash_details
== [r
'stash@{0}: On main: some message/something']
32 def test_stash_info_on_branch_with_slash(app_context
):
34 helper
.run_git('checkout', '-b', 'feature/a')
35 helper
.write_file('A', 'change')
36 helper
.run_git('stash', 'save', 'some message')
38 model
= StashModel(app_context
)
39 stash_info
= model
.stash_info()
41 stash_details
= stash_info
[0][0]
42 assert stash_details
in (
43 'stash@{0}: On feature/a: some message',
44 # Some versions of Git do not report the full branch name
45 'stash@{0}: On a: some message',
48 stash_rev
= stash_info
[1][0]
49 assert stash_rev
== r
'stash@{0}'
51 stash_message
= stash_info
[3][0]
52 assert stash_message
in (
53 'On feature/a: some message',