Skip to content

Commit bf6c325

Browse files
authored
merge(#17): tests for utilities
Added test for utils
2 parents ba55fe1 + f66bdb5 commit bf6c325

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
[![Build Status](https://travis-ci.org/andre-filho/commit-helper.svg?branch=master)](https://travis-ci.org/andre-filho/commit-helper)
22
[![Maintainability](https://api.codeclimate.com/v1/badges/0ef7545d395120222d77/maintainability)](https://codeclimate.com/github/andre-filho/commit-helper/maintainability)
33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/595af9a088cf44e19ec2679a8c2617f6)](https://www.codacy.com/app/andre-filho/commit-helper?utm_source=github.com&utm_medium=referral&utm_content=andre-filho/commit-helper&utm_campaign=Badge_Grade)
44

test/test_conventions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import pytest
2-
2+
# import conventions.karma_angular as angular
3+
# import conventions.changelog as changelog
4+
# import convention.symphony_cmf as symphony
5+
# import conventions.no_convention as no_convention
36

47
def test_angular_convention():
58
pass

test/test_utils.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
11
import pytest
2+
import utils
3+
import yaml
24

35

4-
def test_get_text():
5-
pass
6+
def test_get_text_no_context():
7+
inputs = [
8+
"tag",
9+
"message",
10+
]
611

12+
def mock_input(s):
13+
return inputs.pop(0)
14+
utils.input = mock_input
15+
a, b = utils.get_text()
16+
assert a == 'tag'
17+
assert b == 'message'
718

8-
def test_create_file():
9-
pass
19+
20+
def test_get_text_context():
21+
inputs = [
22+
"tag",
23+
"message",
24+
"context",
25+
]
26+
27+
def mock_input(s):
28+
return inputs.pop(0)
29+
utils.input = mock_input
30+
a, b, c = utils.get_text(context=True)
31+
assert a == 'tag'
32+
assert b == 'message'
33+
assert c == 'context'
34+
35+
# FIXME
36+
# def test_create_file(tmpdir):
37+
# test_file = tmpdir.mkdir('test').join('commiter.yml')
38+
# utils.create_file("changelog")
39+
# stream = open('commiter.yml', 'r')
40+
# convention = yaml.load(stream)
41+
# assert convention['convention'] == 'changelog'

0 commit comments

Comments
 (0)