Source

RIL / test_readitlater.py

Full commit
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-

import logging
import unittest

import readitlater
import test_configs as configs

"""Define test configurations in test_configs.py

RIL_APIKEY = '<your api key>'
RIL_USERNAME = '<username>'
RIL_PASSWORD = '<password>'
"""

class TestAPI(unittest.TestCase):
    def setUp(self):
        self.api = readitlater.API(configs.RIL_APIKEY)

    def test_auth(self):
        self.assertRaises(readitlater.AuthError, self.api.auth, 'invalid_user', 'invalid_password')
        self.assertTrue(self.api.auth(configs.RIL_USERNAME, configs.RIL_PASSWORD))

    def test_add(self):
        self.assertTrue(self.api.add(configs.RIL_USERNAME, configs.RIL_PASSWORD, 
            'http://google.com/', 'Google'))

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG, filename='test.log')

    testsuite = unittest.TestLoader().loadTestsFromTestCase(TestAPI)
    unittest.TextTestRunner(verbosity=2).run(testsuite)