Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Assert a maximum number of SQL queries on API view request tests #526

Open
CloudNiner opened this issue Jun 29, 2017 · 1 comment
Open

Comments

@CloudNiner
Copy link
Contributor

Follow up to #523, we should ensure that other views aren't exhibiting the same behavior by including a check against the number of sql queries ran for each API view test.

@rmartz
Copy link
Contributor

rmartz commented Jun 29, 2017

Django's assertNumQueries will be what we want, it can be used as a wrapper for a code block:

with self.assertNumQueries(2):
    Person.objects.create(name="Aaron")
    Person.objects.create(name="Daniel")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants