Fix missing url_name_args = [] lines in different views.
Fix custom slide create and update view. Fix motion category create and update view.
This commit is contained in:
parent
42efd5ce8e
commit
b0e3c7d456
@ -755,6 +755,7 @@ class CategoryCreateView(CreateView):
|
||||
permission_required = 'motion.can_manage_motion'
|
||||
model = Category
|
||||
success_url_name = 'motion_category_list'
|
||||
url_name_args = []
|
||||
|
||||
category_create = CategoryCreateView.as_view()
|
||||
|
||||
@ -763,6 +764,7 @@ class CategoryUpdateView(UpdateView):
|
||||
permission_required = 'motion.can_manage_motion'
|
||||
model = Category
|
||||
success_url_name = 'motion_category_list'
|
||||
url_name_args = []
|
||||
|
||||
category_update = CategoryUpdateView.as_view()
|
||||
|
||||
|
@ -249,6 +249,7 @@ class CustomSlideCreateView(CreateView):
|
||||
model = ProjectorSlide
|
||||
context_object_name = 'customslide'
|
||||
success_url_name = 'dashboard'
|
||||
url_name_args = []
|
||||
|
||||
|
||||
class CustomSlideUpdateView(UpdateView):
|
||||
@ -260,6 +261,7 @@ class CustomSlideUpdateView(UpdateView):
|
||||
model = ProjectorSlide
|
||||
context_object_name = 'customslide'
|
||||
success_url_name = 'dashboard'
|
||||
url_name_args = []
|
||||
|
||||
|
||||
class CustomSlideDeleteView(DeleteView):
|
||||
|
@ -465,3 +465,29 @@ class TestVersionDeleteView(MotionViewTestCase):
|
||||
self.assertEqual(motion.get_active_version().title, 'new_title_yae6Aequaiw5saeb8suG')
|
||||
response = self.admin_client.post('/motion/1/version/2/del/', {'yes': 1})
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
|
||||
class CategoryViewsTest(TestCase):
|
||||
def setUp(self):
|
||||
self.admin_client = Client()
|
||||
self.admin_client.login(username='admin', password='admin')
|
||||
|
||||
def test_create(self):
|
||||
url = '/motion/category/new/'
|
||||
response = self.admin_client.get(url)
|
||||
self.assertTemplateUsed(response, 'motion/category_form.html')
|
||||
response = self.admin_client.post(url, {'name': 'test_title_eingee0hiveeZ6coohoo'})
|
||||
self.assertRedirects(response, '/motion/category/')
|
||||
self.assertTrue(Category.objects.filter(name='test_title_eingee0hiveeZ6coohoo').exists())
|
||||
|
||||
def test_update(self):
|
||||
# Setup
|
||||
url = '/motion/category/1/edit/'
|
||||
Category.objects.create(name='test_title_chu6zu3deithae1gooL1')
|
||||
# Test
|
||||
response = self.admin_client.get(url)
|
||||
self.assertTemplateUsed(response, 'motion/category_form.html')
|
||||
self.assertContains(response, 'test_title_chu6zu3deithae1gooL1')
|
||||
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')
|
||||
|
42
tests/projector/test_views.py
Normal file
42
tests/projector/test_views.py
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Tests for openslides.projector.views
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
TODO: Move this test to the correct place when the projector app is cleaned up.
|
||||
|
||||
:copyright: 2011–2013 by OpenSlides team, see AUTHORS.
|
||||
:license: GNU GPL, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
from django.test.client import Client
|
||||
|
||||
from openslides.projector.models import ProjectorSlide
|
||||
from openslides.utils.test import TestCase
|
||||
|
||||
|
||||
class CustomSlidesTest(TestCase):
|
||||
def setUp(self):
|
||||
self.admin_client = Client()
|
||||
self.admin_client.login(username='admin', password='admin')
|
||||
|
||||
def test_create(self):
|
||||
url = '/projector/new/'
|
||||
response = self.admin_client.get(url)
|
||||
self.assertTemplateUsed(response, 'projector/new.html')
|
||||
response = self.admin_client.post(url, {'title': 'test_title_roo2xi2EibooHie1kohd', 'weight': '0'})
|
||||
self.assertRedirects(response, '/projector/dashboard/')
|
||||
self.assertTrue(ProjectorSlide.objects.filter(title='test_title_roo2xi2EibooHie1kohd').exists())
|
||||
|
||||
def test_update(self):
|
||||
# Setup
|
||||
url = '/projector/1/edit/'
|
||||
ProjectorSlide.objects.create(title='test_title_jeeDeB3aedei8ahceeso')
|
||||
# Test
|
||||
response = self.admin_client.get(url)
|
||||
self.assertTemplateUsed(response, 'projector/new.html')
|
||||
self.assertContains(response, 'test_title_jeeDeB3aedei8ahceeso')
|
||||
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')
|
Loading…
Reference in New Issue
Block a user