forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_api.py
More file actions
54 lines (45 loc) · 2.23 KB
/
Copy pathtest_api.py
File metadata and controls
54 lines (45 loc) · 2.23 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
import github3
from .helper import IntegrationHelper
class TestAPI(IntegrationHelper):
def get_client(self):
return github3.api.gh
def test_emojis(self):
"""Test the ability to use the /emojis endpoint"""
cassette_name = self.cassette_name('emojis', cls='GitHub')
with self.recorder.use_cassette(cassette_name):
emojis = self.gh.emojis()
assert emojis['+1'] is not None
def test_search_code(self):
"""Test the ability to use the code search endpoint"""
cassette_name = self.cassette_name('search_code',
cls='GitHub')
with self.recorder.use_cassette(cassette_name):
repos = self.gh.search_code(
'HTTPAdapter in:file language:python'
' repo:kennethreitz/requests'
)
assert isinstance(next(repos),
github3.search.CodeSearchResult)
def test_search_users(self):
"""Test the ability to use the user search endpoint"""
cassette_name = self.cassette_name('search_users', cls='GitHub')
with self.recorder.use_cassette(cassette_name):
users = self.gh.search_users('tom followers:>1000')
assert isinstance(next(users),
github3.search.UserSearchResult)
def test_search_issues(self):
"""Test the ability to use the issues search endpoint"""
cassette_name = self.cassette_name('search_issues',
cls='GitHub')
with self.recorder.use_cassette(cassette_name):
issues = self.gh.search_issues('github3 labels:bugs')
assert isinstance(next(issues),
github3.search.IssueSearchResult)
def test_search_repositories(self):
"""Test the ability to use the repository search endpoint"""
cassette_name = self.cassette_name('search_repositories',
cls='GitHub')
with self.recorder.use_cassette(cassette_name):
repos = self.gh.search_repositories('github3 language:python')
assert isinstance(next(repos),
github3.search.RepositorySearchResult)