Skip to content

Commit d1b19e8

Browse files
committed
Update unit tests for show_contribution
0a85b67 suppresses display of contribution if only a single author is present in the file. This has to be reflected in the unit tests.
1 parent 0a85b67 commit d1b19e8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/test_util.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,22 @@ def test_summarize_authors():
114114
}
115115
]
116116

117+
# Default case: don't show contribution
117118
config = { 'show_contribution' : False }
118119
summary = util.Util().summarize(authors, config)
119120
assert summary == "<span class='git-authors'><a href='mailto:[email protected]'>Tim</a></span>"
120121

122+
# Do show contribution, but hide it because there's only one author
121123
config = { 'show_contribution' : True }
122124
summary = util.Util().summarize(authors, config)
123-
assert summary == "<span class='git-authors'><a href='mailto:[email protected]'>Tim</a> (64.23%)</span>"
125+
assert summary == "<span class='git-authors'><a href='mailto:[email protected]'>Tim</a></span>"
126+
127+
# Add another author
128+
authors.append({
129+
'name' : 'Tom',
130+
'email' : '[email protected]',
131+
'contribution' : '35.77%'
132+
})
133+
# Now contribution is displayed
134+
summary = util.Util().summarize(authors, config)
135+
assert summary == "<span class='git-authors'><a href='mailto:[email protected]'>Tim</a> (64.23%), <a href='mailto:[email protected]'>Tom</a> (35.77%)</span>"

0 commit comments

Comments
 (0)