def test_moderator_can_create_topic_before_phase(client, phase_factory, category_factory, admin): phase = phase_factory(phase_content=phases.PrioritizePhase()) module = phase.module project = module.project category = category_factory(module=module) moderator = project.moderators.first() url = reverse('a4dashboard:topic-create', kwargs={ 'organisation_slug': module.project.organisation.slug, 'module_slug': module.slug }) with freeze_pre_phase(phase): client.login(username=moderator.email, password='******') response = client.get(url) assert_template_response(response, 'a4_candy_topicprio/topic_create_form.html') assert response.status_code == 200 topic = { 'name': 'Topic', 'description': 'description', 'category': category.pk, } response = client.post(url, topic) assert response.status_code == 302 assert redirect_target(response) == 'topic-list' count = models.Topic.objects.all().count() assert count == 1
def test_user_cannot_create_topic(client, phase_factory, user): phase = phase_factory(phase_content=phases.PrioritizePhase()) module = phase.module url = reverse('a4dashboard:topic-create', kwargs={ 'organisation_slug': module.project.organisation.slug, 'module_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
def test_anonymous_cannot_create_topic(client, phase_factory): phase = phase_factory(phase_content=phases.PrioritizePhase()) module = phase.module url = reverse('a4dashboard:topic-create', kwargs={ 'organisation_slug': module.project.organisation.slug, 'module_slug': module.slug }) with freeze_phase(phase): count = models.Topic.objects.all().count() assert count == 0 response = client.get(url) assert response.status_code == 302 assert redirect_target(response) == 'account_login'
content=[ question_phases.IssuePhase(), ], image='images/live-discussion.svg', settings_model=None, )), ('topic-prioritization', ProjectBlueprint( title=_('Prioritization'), description=_( 'Participants can discuss and rate (pro/contra) previously ' 'added ideas and topics. Participants cannot add ideas or ' 'topics.' ), content=[ topicprio_phases.PrioritizePhase(), ], image='images/priorization.svg', settings_model=None, )), ('debate', ProjectBlueprint( title=_('Debate'), description=_( 'Participants can discuss posted topics or questions. ' 'To do this, the participants comment on posted ' 'topics / questions as well as on contributions from other ' 'users.' ), content=[