-
-
Notifications
You must be signed in to change notification settings - Fork 252
/
Copy pathtest_contribute.py
32 lines (27 loc) · 1.08 KB
/
test_contribute.py
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
30
31
32
import unittest
import contribute
from subprocess import check_output
class TestContribute(unittest.TestCase):
def test_arguments(self):
args = contribute.arguments(['-nw'])
self.assertTrue(args.no_weekends)
self.assertEqual(args.max_commits, 10)
self.assertTrue(1 <= contribute.contributions_per_day(args) <= 20)
def test_contributions_per_day(self):
args = contribute.arguments(['-nw'])
self.assertTrue(1 <= contribute.contributions_per_day(args) <= 20)
def test_commits(self):
contribute.NUM = 11 # limiting the number only for unittesting
contribute.main(['-nw',
'--user_name=sampleusername',
'-mc=12',
'-fr=82',
'-db=10',
'-da=15'])
self.assertTrue(1 <= int(check_output(
['git',
'rev-list',
'--count',
'HEAD']
).decode('utf-8')) <= 20*(10 + 15))