Skip to content

Commit b87e1ed

Browse files
committed
✅ pass test_remote.py
1 parent e0072c5 commit b87e1ed

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/test_remote.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python3
2+
# coding:utf8
3+
4+
import sys
5+
import os
6+
import unittest
7+
from unittest.mock import patch
8+
from code_counter.__main__ import main
9+
10+
test_path = os.path.abspath('.')
11+
bin_path = os.path.dirname(os.path.join(os.pardir, '..'))
12+
lib_path = os.path.abspath(os.path.join(bin_path, 'code_counter'))
13+
app_path = os.path.join(lib_path, '__main__.py')
14+
15+
16+
class CodeCounterRemoteTest(unittest.TestCase):
17+
@patch('builtins.input')
18+
def test_remote_case1(self, mock_input):
19+
mock_input.side_effect = ['']
20+
options = ['python', app_path,
21+
'remote',
22+
'https://github.com/innofang/code-counter.git',
23+
'-v',
24+
'-o=output.txt']
25+
sys.argv[1:] = options[2:]
26+
try:
27+
main()
28+
except:
29+
print('Occur Error!')
30+
31+
output_path = os.path.join(test_path, 'output.txt')
32+
self.assertTrue(os.path.exists(output_path))
33+
os.remove(output_path)

0 commit comments

Comments
 (0)