forked from nnja/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (21 loc) · 962 Bytes
/
test.py
File metadata and controls
32 lines (21 loc) · 962 Bytes
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 repos.api
import repos.exceptions
import unittest
class TestCreateQuery(unittest.TestCase):
def test_create_query(self):
test_languages = ["Python", "Ruby", "Java"]
test_min_stars = 10000
expected = "language:Python language:Ruby language:Java stars:>10000"
result = repos.api.create_query(test_languages, test_min_stars)
self.assertEqual(result, expected, "Unexpected result from create_query")
class TestGitHubApiException(unittest.TestCase):
def test_exception_403(self):
status_code = 403
exception = repos.exceptions.GitHubApiException(status_code)
self.assertTrue("Rate limit" in str(exception), "'Rate limit' not found")
def test_exception_500(self):
status_code = 500
exception = repos.exceptions.GitHubApiException(status_code)
self.assertTrue(str(status_code) in str(exception))
if __name__ == "__main__":
unittest.main()