1 """Tests basic git operations: commit, log, config"""
2 # pylint: disable=redefined-outer-name
3 from __future__
import absolute_import
, division
, print_function
, unicode_literals
6 from .helper
import app_context
9 # These assertions make flake8 happy. It considers them unused imports otherwise.
10 assert app_context
is not None
13 def test_git_commit(app_context
):
14 """Test running 'git commit' via cola.git"""
15 helper
.write_file('A', 'A')
16 helper
.write_file('B', 'B')
17 helper
.run_git('add', 'A', 'B')
19 app_context
.git
.commit(m
='initial commit')
20 log
= helper
.run_git('-c', 'log.showsignature=false', 'log', '--pretty=oneline')
23 actual
= len(log
.splitlines())
24 assert expect
== actual
27 def test_git_config(app_context
):
28 """Test cola.git.config()"""
29 helper
.run_git('config', 'section.key', 'value')
30 expect
= (0, 'value', '')
31 actual
= app_context
.git
.config('section.key', get
=True)
32 assert expect
== actual