Is APITest with Query params different then just normal url?

Try passing the query parameter as a data payload instead. Change the line in your test to:

response = self.client.get('/api/titles-and-blurbs/', {'genre': 'horror'})

Django docs here on the different ways to pass query parameters in urls.

Another person reported a similar issue with an empty QUERY_PARAMS while testing DRF (see here). It looks like they fixed it but maybe they missed something or you didn’t get the update.

Leave a Comment