-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_github.py
42 lines (28 loc) · 931 Bytes
/
test_github.py
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
# -*- coding: utf-8 -*-
"""
Tests for the Github API library.
"""
import unittest
from httmock import with_httmock
import github
import mocks.github
class TestGithub(unittest.TestCase):
@with_httmock(mocks.github.resource_get)
def test_get_repository(self):
owner = 'appneta'
repo = 'burndown'
results = github.get_repository(owner, repo)
self.assertNotEqual(results, None)
self.assertIsInstance(results, dict)
self.assertTrue('name' in results)
self.assertEqual(results['name'], repo)
@with_httmock(mocks.github.resource_get)
def test_get_user(self):
user = 'danriti'
results = github.get_user(user)
self.assertNotEqual(results, None)
self.assertIsInstance(results, dict)
self.assertTrue('login' in results)
self.assertEqual(results['login'], user)
if __name__ == '__main__':
unittest.main()