From a49b0fc2b757f7bbaa084e5cb0dc58c1700373d7 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 21 Feb 2011 14:51:54 -0500 Subject: [PATCH] Real tests w/ configuration. --- test_convore.py | 53 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/test_convore.py b/test_convore.py index 68717c0..5bcebc5 100644 --- a/test_convore.py +++ b/test_convore.py @@ -1,25 +1,68 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +""" + convore tests + ~~~~~~~~~~~~~ + Convore test suite. + + Looks for authentication in 'CONVORE_NAME' and + 'CONVORE_PASS' environment variables. + + :copyright: (c) 2011 by Kenneth Reitz. + :license: ISC, see LICENSE for more details. +""" + + +import os import unittest import convore -class ConvoreTestSuite(unittest.TestCase): +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): - pass + self.convore = convore.Convore(CONVORE_NAME, CONVORE_PASS) def tearDown(self): pass def test_convore_login(self): - _convore = convore.Convore('requeststest', 'requeststest') - self.assertEqual(_convore.account_verify(), True) + 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): + convore.groups.discover.category if __name__ == '__main__':