Test max_calls == 0

This commit is contained in:
vagrant
2013-12-12 16:35:20 +00:00
committed by Diana Huang
parent a5d1cb3592
commit 883563d8df

View File

@@ -173,3 +173,14 @@ class FindUsersTests(unittest.TestCase):
[i % 2 == 0 for i in xrange(9)])
self.assertEqual(users[9].linkedin.has_linkedin_account, None)
self.assertTrue(command.stderr.getvalue().startswith("WARNING"))
@mock.patch('linkedin.management.commands.findusers.get_call_limits')
def test_command_no_api_calls(self, get_call_limits):
"""
Test rechecking all users with no API limits.
"""
from django.core.management.base import CommandError
fut = findusers.Command().handle
get_call_limits.return_value = (0, 0, 0)
with self.assertRaises(CommandError):
fut(recheck=True)