[Answer]-How to test NumQueries in ListView?

1👍

TestCase.assertNumQueries takes as a first argument the expected number of queries, as a second argument, the function you want to test and as the rest of the arguments, the arguments for the function you want to test.

In your case, the function you want to test is a view that requires one argument: an HttpRequest. You then need to pass an HttpRequest as a third parameter to assertNumQueries. You may use RequestFactory to create an HttpRequest for test purposes.

👤aumo

Leave a comment