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