@@ -107,20 +107,23 @@ def test_redirect_preview_in_edit_mode(self):
107
107
page_content = create_page_content ("en" , "home" , page , redirect = "https://example.com" )
108
108
109
109
page .set_as_homepage ()
110
-
110
+ expected = f"""
111
+ <div class="cms-screenblock">
112
+ <div class="cms-screenblock-inner">
113
+ <h1>This page has no preview!</h1>
114
+ <p>It is being redirected to: <a href="{ page_content .redirect } ">{ page_content .redirect } </a></p>
115
+ </div>
116
+ </div>
117
+ """
111
118
with self .login_user_context (user ), force_language ('fr' ):
112
- edit_url = get_object_edit_url (page_content , language = 'fr' )
113
- response = self .client .get (edit_url , follow = True )
114
-
115
- expected = f"""
116
- <div class="cms-screenblock">
117
- <div class="cms-screenblock-inner">
118
- <h1>This page has no preview!</h1>
119
- <p>It is being redirected to: <a href="{ page_content .redirect } ">{ page_content .redirect } </a></p>
120
- </div>
121
- </div>
122
- """
123
- self .assertContains (response , expected , count = 1 , html = True )
119
+ with self .subTest ("Edit endpoint shows redirect message" ):
120
+ url = get_object_edit_url (page_content , language = 'fr' )
121
+ response = self .client .get (url )
122
+ self .assertContains (response , expected , count = 1 , html = True )
123
+ with self .subTest ("Preview endpoint shows redirect message" ):
124
+ url = get_object_preview_url (page_content , language = 'fr' )
125
+ response = self .client .get (url )
126
+ self .assertContains (response , expected , count = 1 , html = True )
124
127
125
128
def test_external_redirect (self ):
126
129
# test external redirect
0 commit comments