Skip to content

Commit 0ad792c

Browse files
committed
add test
1 parent 4872114 commit 0ad792c

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/test_mkexcel.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# coding=utf-8
2+
# author@alingse
3+
# 2020.03.10
4+
5+
import unittest
6+
from click.testing import CliRunner
7+
8+
from jsoncsv.main import mkexcel
9+
10+
11+
class Testmkexcel(unittest.TestCase):
12+
def test_mkexcel_csv(self):
13+
runner = CliRunner()
14+
args = ['fixture/files/expand.0.json',
15+
'fixture/files/tmp.expand.0.csv']
16+
result = runner.invoke(mkexcel, args=args)
17+
assert result.exit_code == 0
18+
19+
def test_mkexcel_xls(self):
20+
runner = CliRunner()
21+
args = ['-t', 'xls', 'fixture/files/expand.0.json',
22+
'fixture/files/tmp.expand.0.xls']
23+
result = runner.invoke(mkexcel, args=args)
24+
assert result.exit_code == 0
25+
26+
def test_mkexcel_with_error(self):
27+
runner = CliRunner()
28+
args = ['-t', 'xlsx', 'fixture/files/expand.0.json',
29+
'fixture/files/tmp.expand.0.xls']
30+
result = runner.invoke(mkexcel, args=args)
31+
assert result.exit_code == 2

0 commit comments

Comments
 (0)