File: gitops_test.py

package info (click to toggle)
git-cola 4.13.0-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 6,480 kB
  • sloc: python: 36,938; sh: 304; makefile: 223; xml: 100; tcl: 62
file content (29 lines) | stat: -rw-r--r-- 816 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Tests basic git operations: commit, log, config"""
from . import helper
from .helper import app_context


# Prevent unused imports lint errors.
assert app_context is not None


def test_git_commit(app_context):
    """Test running 'git commit' via cola.git"""
    helper.write_file('A', 'A')
    helper.write_file('B', 'B')
    helper.run_git('add', 'A', 'B')

    app_context.git.commit(m='initial commit')
    log = helper.run_git('-c', 'log.showsignature=false', 'log', '--pretty=oneline')

    expect = 1
    actual = len(log.splitlines())
    assert expect == actual


def test_git_config(app_context):
    """Test cola.git.config()"""
    helper.run_git('config', 'section.key', 'value')
    expect = (0, 'value', '')
    actual = app_context.git.config('section.key', get=True)
    assert expect == actual