@@ -179,3 +179,33 @@ def test_admin_form_edit_when_locked(self):
179
179
self .assertContains (response , '<div class="readonly">Test Snippet</div>' )
180
180
# We should have the same number of snippets as before
181
181
self .assertEqual (Snippet .objects .count (), 1 )
182
+
183
+ @override_settings (DJANGOCMS_SNIPPET_VERSIONING_ENABLED = False )
184
+ def test_slug_colomn_should_hyperlinked_with_versioning_disabled (self ):
185
+ """
186
+ Slug column should be visible and hyperlinked when versioning is disabled
187
+ """
188
+ admin .site .unregister (Snippet )
189
+ reload (cms_config )
190
+ reload (snippet_admin )
191
+
192
+ with self .login_user_context (self .get_superuser ()):
193
+ response = self .client .get (self .changelist_url )
194
+ self .assertContains (response , '<th class="field-slug"><a href="/en/admin/djangocms_snippet/'
195
+ 'snippet/1/change/">test-snippet</a></th>' )
196
+
197
+ @override_settings (DJANGOCMS_SNIPPET_VERSIONING_ENABLED = True )
198
+ def test_name_colomn_should_not_be_hyperlinked_with_versioning_enabled (self ):
199
+ """
200
+ Name column should be visible and not hyperlinked when versioning is enabled.
201
+ Slug column should not be visible when versioning is enabled.
202
+ """
203
+ admin .site .unregister (Snippet )
204
+ reload (cms_config )
205
+ reload (snippet_admin )
206
+
207
+ with self .login_user_context (self .get_superuser ()):
208
+ response = self .client .get (self .changelist_url )
209
+ self .assertContains (response , '<td class="field-name">Test Snippet</td>' )
210
+ self .assertNotContains (response , '<th class="field-slug"><a href="/en/admin/djangocms_snippet/'
211
+ 'snippet/1/change/">test-snippet</a></th>' )
0 commit comments