This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
forked from kennethreitz-archive/python-convore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_convore.py
73 lines (45 loc) · 1.67 KB
/
test_convore.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
convore tests
~~~~~~~~~~~~~
Convore test suite.
Looks for authentication in 'CONVORE_NAME' and
'CONVORE_PASS' environment variables for configuration.
:copyright: (c) 2011 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
import os
import unittest2 as unittest
import convore
CONVORE_NAME = os.environ.get('CONVORE_NAME', 'requeststest')
CONVORE_PASS = os.environ.get('CONVORE_PASS', 'requeststest')
class ConvoreAPI(unittest.TestCase):
"""Requests test cases."""
def setUp(self):
self.convore = convore.Convore(CONVORE_NAME, CONVORE_PASS)
def tearDown(self):
pass
def test_convore_login(self):
self.assertEqual(self.convore.account_verify(), True)
class ConvoreGroups(unittest.TestCase):
def setUp(self):
self.convore = convore.Convore(CONVORE_NAME, CONVORE_PASS)
def test_works(self):
self.convore.groups
def test_cache_works(self):
int_before = int(len(self.convore.groups))
self.convore.groups[81]
int_after = int(len(self.convore.groups))
self.assertEqual((int_after - int_before), 1)
def test_discover_explore(self):
self.convore.groups.discover.explore.popular()
self.convore.groups.discover.explore.recent()
self.convore.groups.discover.explore.alphabetical()
def test_discover_category(self):
self.convore.groups.discover.category
self.convore.groups.discover.category['gossip']
def test_discover_search(self):
self.convore.groups.discover.search('github')
if __name__ == '__main__':
unittest.main()