def test_requests_all_users(self): "If no ids supplied, uses all users in the DB" users = UserFactory.create_batch(5) result = UsersFetcher(screen_name='jill').fetch() ids = User.objects.values_list('twitter_id', flat=True).order_by('fetch_time') ids = '%2C'.join(map(str, ids)) self.assertIn(ids, responses.calls[0][0].url)
def test_with_accounts_manager(self): "Only returns Users with Accounts" users = UserFactory.create_batch(4) account_1 = AccountFactory(user=users[0]) account_2 = AccountFactory(user=users[2]) users_with_accounts = User.objects_with_accounts.all() self.assertEqual(2, len(users_with_accounts)) self.assertEqual(users_with_accounts[0].pk, users[0].pk) self.assertEqual(users_with_accounts[1].pk, users[2].pk)