def test_admin_can_create_mapidea_in_wrong_phase(client, phase_factory, category_factory, admin, area_settings_factory): phase = phase_factory(phase_content=phases.RatingPhase()) module = phase.module area_settings_factory(module=module) category = category_factory(module=module) url = reverse('mapidea-create', kwargs={'slug': module.slug}) with freeze_phase(phase): client.login(username=admin.email, password='******') response = client.get(url) assert_template_response( response, '{{ cookiecutter.project_app_prefix }}_mapideas/mapidea_form.html') assert response.status_code == 200 mapidea = { 'name': 'MapIdea', 'description': 'description', 'category': category.pk, 'point': (0, 0), 'point_label': 'somewhere' } response = client.post(url, mapidea) assert response.status_code == 302 assert redirect_target(response) == 'mapidea-detail' count = models.MapIdea.objects.all().count() assert count == 1
def test_user_cannot_create_mapidea_in_wrong_phase(client, user, phase_factory): phase = phase_factory(phase_content=phases.RatingPhase()) module = phase.module url = reverse('mapidea-create', kwargs={'slug': module.slug}) with freeze_phase(phase): response = client.get(url) assert response.status_code == 302 client.login(username=user.email, password='******') response = client.get(url) assert response.status_code == 403
ideas_phases.RatingPhase(), ], image='images/agenda-setting.svg', settings_model=None, )), ('map-idea-collection', ProjectBlueprint( title=_('Spatial Idea Challenge'), description=_( 'In a first phase, participants can submit their own ideas, ' 'mark them on a map, and discuss the ideas of others. In a ' 'second phase, the ideas can be rated (pro/contra).' ), content=[ mapideas_phases.CollectPhase(), mapideas_phases.RatingPhase() ], image='images/map-idea-collection.svg', settings_model=('a4maps', 'AreaSettings'), )), ('text-review', ProjectBlueprint( title=_('Text Review'), description=_( 'Participants can discuss the paragraphs of a text that you ' 'added beforehand.' ), content=[ documents_phases.CommentPhase(), ], image='images/text-review.svg',