... ... ce or absence of HTML fragments assertTemplateUsed() Template usage in a response assertURLEqual() That two URLs are equal assertRedirects() That an HTTP redirect occurred assertHTMLEqual() HTML fragment equality assertInHTML() HTML fragment containment assertX ... se ): def test_login ( self ): # First check for the default behavior response = self . client . get ( "/sekrit/" ) self . assertRedirects ( response , "/accounts/login/?next=/sekrit/" ) # Then override the LOGIN_URL setting with self . settings ( LOGIN_URL = " ... /other/login/" ): response = self . client . get ( "/sekrit/" ) self . assertRedirects ( response , "/other/login/?next=/sekrit/" ) この例では、 with ブロック内のコードに対して、 LOGIN_URL 設定をオーバーライド ... ... unner , which facilitate overriding the way tests are collected and run. The fetch_redirect_response argument was added to assertRedirects() . Since the test client can't fetch externals URLs, this allows you to use assertRedirects with redirects that aren't pa ... rt of your Django app. Correct handling of scheme when making comparisons in assertRedirects() . The secure argument was added to all the request methods of Client . If True , the request will be made through HTTPS. ... ... ecognizing the actual practice of user agents, almost all of which support them. Consequently, the expected URLs passed to assertRedirects should generally no longer include the scheme and domain part of the URLs. For example, self.assertRedirects(response, 'ht ... tp://testserver/some-url/') should be replaced by self.assertRedirects(response, '/some-url/') (unless the redirection specifically contained an absolute URL). In the rare case that you need th ... ... テスト The new SimpleTestCase.assertURLEqual() assertion checks for a given URL, ignoring the ordering of the query string. assertRedirects() uses the new assertion. The test Client now supports automatic JSON serialization of list and tuple data when content_ty ... ... is happens, simply remove the URL quoting from your code. You will also have to replace special characters in URLs used in assertRedirects() with their encoded versions. Storage of IP addresses in the comments app The comments app now uses a GenericIPAddressFie ... ... tCase のメソッド) assertQuerySetEqual() (TransactionTestCase のメソッド) assertRaisesMessage() (SimpleTestCase のメソッド) assertRedirects() (SimpleTestCase のメソッド) assertTemplateNotUsed() (SimpleTestCase のメソッド) assertTemplateUsed() (SimpleTestCase のメ ... 2026年10月08日