mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Cover all code paths in search_commits (#2087)
The search_commits method was only very lightly tested, meaning over half of it was not covered. Write another test case, covering all code paths.
This commit is contained in:
+3
-7
@@ -598,19 +598,15 @@ class Github:
|
||||
"""
|
||||
assert isinstance(query, str), query
|
||||
url_parameters = dict()
|
||||
if (
|
||||
sort is not github.GithubObject.NotSet
|
||||
): # pragma no branch (Should be covered)
|
||||
if sort is not github.GithubObject.NotSet:
|
||||
assert sort in ("author-date", "committer-date"), sort
|
||||
url_parameters["sort"] = sort
|
||||
if (
|
||||
order is not github.GithubObject.NotSet
|
||||
): # pragma no branch (Should be covered)
|
||||
if order is not github.GithubObject.NotSet:
|
||||
assert order in ("asc", "desc"), order
|
||||
url_parameters["order"] = order
|
||||
|
||||
query_chunks = []
|
||||
if query: # pragma no branch (Should be covered)
|
||||
if query:
|
||||
query_chunks.append(query)
|
||||
|
||||
for qualifier, value in qualifiers.items():
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -195,6 +195,15 @@ class Search(Framework.TestCase):
|
||||
)
|
||||
self.assertEqual(commits.totalCount, 3)
|
||||
|
||||
def testSearchCommits(self):
|
||||
commits = self.g.search_commits(
|
||||
query="hash:1265747e992ba7d34a469b6b2f527809f8bf7067",
|
||||
sort="author-date",
|
||||
order="asc",
|
||||
merge="false",
|
||||
)
|
||||
self.assertEqual(commits.totalCount, 2)
|
||||
|
||||
def testSearchTopics(self):
|
||||
topics = self.g.search_topics("python", repositories=">950")
|
||||
self.assertListKeyBegin(
|
||||
|
||||
Reference in New Issue
Block a user