def should_redirect_to_login_when_anonymous(self, url=None):
if not url:<EOL><INDENT>url = self.get_url()<EOL><DEDENT>resp = self.client.get(url)<EOL>self.assertRedirects(resp, '<STR_LIT>'.format(<EOL>self.get_login_url(), url))<EOL>return resp<EOL>
Tests if the view redirects to login when the user is anonymous.

:param url: A string representing the URL to be called. If ``None``,
  the return value of ``get_url()`` will be used.