예제 #1
0
def test_admin_can_create_idea_in_wrong_phase(client, phase_factory,
                                              category_factory, admin):
    phase = phase_factory(phase_content=phases.RatingPhase())
    module = phase.module
    category = category_factory(module=module)
    url = reverse('a4_candy_ideas:idea-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_ideas/idea_create_form.html')
        assert response.status_code == 200
        idea = {
            'name': 'Idea',
            'description': 'description',
            'category': category.pk,
        }
        response = client.post(url, idea)
        assert response.status_code == 302
        assert redirect_target(response) == 'idea-detail'
        count = models.Idea.objects.all().count()
        assert count == 1
예제 #2
0
def test_user_cannot_create_idea_in_wrong_phase(client, phase_factory, user):
    phase = phase_factory(phase_content=phases.RatingPhase())
    module = phase.module
    url = reverse('idea-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
예제 #3
0
          mapideas_phases.CollectPhase(),
      ],
      image='images/map-brainstorming.svg',
      settings_model=('a4maps', 'AreaSettings'),
  )),
 ('agenda-setting',
  ProjectBlueprint(
      title=_('Idea Challenge'),
      description=_(
          'In a first phase, participants can submit their own ideas '
          'and discuss the ideas of others. In a second phase, the '
          'ideas can be rated (pro/contra).'
      ),
      content=[
          ideas_phases.CollectPhase(),
          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()