Beispiel #1
0
def test_initiator_can_export_subject_comments(client, phase_factory):
    phase = phase_factory(phase_content=phases.DebatePhase())
    module = phase.module
    initiator = module.project.organisation.initiators.first()
    client.login(username=initiator.email, password='******')
    url = reverse(
        'a4dashboard:subject-export-module',
        kwargs={
            'organisation_slug': module.project.organisation.slug,
            'module_slug': module.slug
        })
    with freeze_phase(phase):
        response = client.get(url)
        assert response.status_code == 200
        export_url = reverse(
            'a4dashboard:subject-comment-export',
            kwargs={
                'organisation_slug': module.project.organisation.slug,
                'module_slug': module.slug
            })
        assert response.context['comment_export'] == export_url
        response = client.get(export_url)
        assert response.status_code == 200
        assert 'application/vnd.openxmlformats-officedocument.'\
            'spreadsheetml.sheet' == response['Content-Type']
Beispiel #2
0
def test_user_cannot_create_topic(client, phase_factory, user):
    phase = phase_factory(phase_content=phases.DebatePhase())
    module = phase.module
    url = reverse('a4dashboard:subject-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
Beispiel #3
0
def test_anonymous_cannot_create_topic(client, phase_factory):
    phase = phase_factory(phase_content=phases.DebatePhase())
    module = phase.module
    url = reverse('a4dashboard:subject-create',
                  kwargs={
                      'organisation_slug': module.project.organisation.slug,
                      'module_slug': module.slug
                  })
    with freeze_phase(phase):
        count = models.Subject.objects.all().count()
        assert count == 0
        response = client.get(url)
        assert response.status_code == 302
        assert redirect_target(response) == 'account_login'
Beispiel #4
0
def test_admin_can_create_topic(client, phase_factory, category_factory,
                                admin):
    phase = phase_factory(phase_content=phases.DebatePhase())
    module = phase.module
    url = reverse('a4dashboard:subject-create',
                  kwargs={
                      'organisation_slug': module.project.organisation.slug,
                      'module_slug': module.slug
                  })
    with freeze_phase(phase):
        client.login(username=admin.email, password='******')
        response = client.get(url)
        assert_template_response(response,
                                 'a4_candy_debate/subject_create_form.html')
        assert response.status_code == 200
        subject = {'name': 'Subject'}
        response = client.post(url, subject)
        assert response.status_code == 302
        assert redirect_target(response) == 'subject-list'
        count = models.Subject.objects.all().count()
        assert count == 1
Beispiel #5
0
     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=[
             debate_phases.DebatePhase(),
         ],
         image='images/debate.svg',
         settings_model=None,
     )),
]