forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_repos_commit.py
More file actions
65 lines (46 loc) · 1.98 KB
/
Copy pathtest_repos_commit.py
File metadata and controls
65 lines (46 loc) · 1.98 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""Unit tests for Repository Commits."""
import github3
from . import helper
get_commit_example_data = helper.create_example_data_helper("commit_example")
example_commit_data = get_commit_example_data()
url_for = helper.create_url_helper(example_commit_data["url"])
class TestRepoCommitIterator(helper.UnitIteratorHelper):
"""Unit tests for RepoCommit iterator methods."""
described_class = github3.repos.commit.RepoCommit
example_data = example_commit_data
def test_statuses(self):
"""Verify the request to iterate over statuses of a commit."""
i = self.instance.statuses()
self.get_next(i)
self.session.get.assert_called_once_with(
url_for("statuses"), params={"per_page": 100}, headers={}
)
def test_comments(self):
"""Verify the request to iterate over comments of a commit."""
i = self.instance.comments()
self.get_next(i)
self.session.get.assert_called_once_with(
url_for("comments"), params={"per_page": 100}, headers={}
)
class TestRepoCommitIteratorAppInstAuth(helper.UnitIteratorAppInstHelper):
"""Unit tests for RepoCommit iterator methods."""
described_class = github3.repos.commit.RepoCommit
example_data = example_commit_data
def test_check_runs(self):
"""Verify the request to iterate over check runs of a commit."""
i = self.instance.check_runs()
self.get_next(i)
self.session.get.assert_called_once_with(
url_for("check-runs"),
params={"per_page": 100},
headers=github3.checks.CheckRun.CUSTOM_HEADERS,
)
def test_check_suits(self):
"""Verify the request to iterate over check suits of a commit."""
i = self.instance.check_suites()
self.get_next(i)
self.session.get.assert_called_once_with(
url_for("check-suites"),
params={"per_page": 100},
headers=github3.checks.CheckSuite.CUSTOM_HEADERS,
)