mirror of
https://github.com/kennethreitz-archive/python-convore.git
synced 2026-06-05 23:40:18 +00:00
Search endpoint works.
This commit is contained in:
+15
-1
@@ -24,6 +24,8 @@ class GroupsDiscover(object):
|
||||
self.category = GroupDiscoverCategory()
|
||||
self.category.parent = self
|
||||
|
||||
self.search = GroupDiscoverSearch()
|
||||
|
||||
def _discover_group(self, *cats):
|
||||
_groups = []
|
||||
r = api.get('groups', 'discover', *cats)
|
||||
@@ -107,6 +109,18 @@ class GroupDiscoverSearch(object):
|
||||
return '<groups/discover/search endpoint>'
|
||||
|
||||
def __getitem__(self, key):
|
||||
return 'searched.'
|
||||
|
||||
_groups = []
|
||||
|
||||
r = api.get('groups', 'discover', 'search', params={'q': key})
|
||||
for group in deserialize(r.content)['groups']:
|
||||
_group = models.Group()
|
||||
_group.import_from_api(group)
|
||||
_groups.append(_group)
|
||||
|
||||
if len(_groups):
|
||||
return _groups
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -67,7 +67,8 @@ class ConvoreGroups(unittest.TestCase):
|
||||
c = self.convore.groups.discover.category['gossip']
|
||||
self.assertIsInstance(c, convore.models.Category)
|
||||
|
||||
|
||||
def test_discover_search(self):
|
||||
self.convore.groups.discover.search['github']
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user