Search endpoint works.

This commit is contained in:
Kenneth Reitz
2011-02-21 15:55:24 -05:00
parent 5377ecfd47
commit 17447de05a
2 changed files with 17 additions and 2 deletions
+15 -1
View File
@@ -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
View File
@@ -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()