I am writing unittests for django views. I have observed that one of my views returns redirection code 301, which is not expected.
Here is my views.py mentioned earlier.
You have defined a url that matches /query/, but you are testing /query. Django is redirecting to the url with the trailing slash because APPEND_SLASH=True in your settings.