@@ -150,3 +150,28 @@ def test_story_multiline_email_subject(self):
150
150
self .assertNotIn ('Second line' , mail .outbox [0 ].subject )
151
151
152
152
del mail .outbox [:]
153
+
154
+ def test_story_duplicate_slug (self ):
155
+ url = reverse ('success_story_create' )
156
+
157
+ post_data = {
158
+ 'name' : 'r87comwwwpythonorg' ,
159
+ 'company_name' : 'Company Three' ,
160
+ 'company_url' : 'http://djangopony.com/' ,
161
+ 'category' : self .category .pk ,
162
+ 'author' : 'Kevin Arnold' ,
163
+ 'author_email' :
'[email protected] ' ,
164
+ 'pull_quote' : 'Liver!' ,
165
+ 'content' : 'Growing up is never easy.\n \n Foo bar baz.\n ' ,
166
+ settings .HONEYPOT_FIELD_NAME : settings .HONEYPOT_VALUE ,
167
+ }
168
+
169
+ response = self .client .post (url , post_data )
170
+ self .assertEqual (response .status_code , 302 )
171
+ self .assertRedirects (response , url )
172
+
173
+ post_data = post_data .copy ()
174
+ post_data ['name' ] = '///r87.com/?www.python.org/'
175
+ response = self .client .post (url , post_data )
176
+ self .assertEqual (response .status_code , 200 )
177
+ self .assertContains (response , 'Please use a unique name.' )
0 commit comments