Fix url_name_args bug.
Fix delete view for motion categories. Add test for custom slide delete view.
This commit is contained in:
parent
8303c4444f
commit
9d80c05f90
@ -773,6 +773,7 @@ class CategoryDeleteView(DeleteView):
|
||||
permission_required = 'motion.can_manage_motion'
|
||||
model = Category
|
||||
question_url_name = 'motion_category_list'
|
||||
url_name_args = []
|
||||
success_url_name = 'motion_category_list'
|
||||
|
||||
category_delete = CategoryDeleteView.as_view()
|
||||
|
@ -491,3 +491,14 @@ class CategoryViewsTest(TestCase):
|
||||
response = self.admin_client.post(url, {'name': 'test_title_jaiShae1sheingahlee2'})
|
||||
self.assertRedirects(response, '/motion/category/')
|
||||
self.assertEqual(Category.objects.get(pk=1).name, 'test_title_jaiShae1sheingahlee2')
|
||||
|
||||
def test_delete(self):
|
||||
# Setup
|
||||
url = '/motion/category/1/del/'
|
||||
Category.objects.create(name='test_title_nei1wooHes2aiquuraep')
|
||||
# Test
|
||||
response = self.admin_client.get(url)
|
||||
self.assertRedirects(response, '/motion/category/')
|
||||
response = self.admin_client.post(url, {'yes': 'true'})
|
||||
self.assertRedirects(response, '/motion/category/')
|
||||
self.assertFalse(Category.objects.exists())
|
||||
|
@ -40,3 +40,14 @@ class CustomSlidesTest(TestCase):
|
||||
response = self.admin_client.post(url, {'title': 'test_title_ai8Ooboh5bahr6Ee7goo', 'weight': '0'})
|
||||
self.assertRedirects(response, '/projector/dashboard/')
|
||||
self.assertEqual(ProjectorSlide.objects.get(pk=1).title, 'test_title_ai8Ooboh5bahr6Ee7goo')
|
||||
|
||||
def test_delete(self):
|
||||
# Setup
|
||||
url = '/projector/1/del/'
|
||||
ProjectorSlide.objects.create(title='test_title_oyie0em1chieM7YohX4H')
|
||||
# Test
|
||||
response = self.admin_client.get(url)
|
||||
self.assertRedirects(response, '/projector/1/edit/')
|
||||
response = self.admin_client.post(url, {'yes': 'true'})
|
||||
self.assertRedirects(response, '/projector/dashboard/')
|
||||
self.assertFalse(ProjectorSlide.objects.exists())
|
||||
|
Loading…
Reference in New Issue
Block a user