Skip to content

Commit

Permalink
fixup! admin: prefetch related fields
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Sep 22, 2017
1 parent 1972feb commit 25f77aa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pinax/stripe/tests/test_admin.py
@@ -1,5 +1,6 @@
import datetime

import django
from django.contrib.auth import get_user_model
from django.test import Client, TestCase
from django.utils import timezone
Expand Down Expand Up @@ -99,8 +100,16 @@ def setUp(self):
def test_customer_admin(self):
"""Make sure we get good responses for all filter options"""
url = reverse('admin:pinax_stripe_customer_changelist')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)

# Django 1.10 has the following query twice:
# SELECT COUNT(*) AS "__count" FROM "pinax_stripe_customer"
# (since https://github.com/django/django/commit/5fa7b592b3f)
# We might want to test for "num < 10" here instead, and/or compare the
# number to be equal with X and X+1 customers
num = 8 if django.VERSION >= (1, 10) else 7
with self.assertNumQueries(num):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)

response = self.client.get(url + '?sub_status=active')
self.assertEqual(response.status_code, 200)
Expand Down

0 comments on commit 25f77aa

Please sign in to comment.