Ejemplo n.º 1
0
    def test_group_curators_validation(self):
        group = GroupFactory.create()
        curator = UserFactory.create()
        group.curators.add(curator.userprofile)

        # Update form without adding curators
        form_data = {'name': 'test_group',
                     'curators': []}
        form = forms.GroupCuratorsForm(instance=group, data=form_data)

        ok_(not form.is_valid())
        eq_(form.errors, {'curators': [u'The group must have at least one curator.']})
Ejemplo n.º 2
0
    def test_legacy_group_curators_validation(self):
        group = GroupFactory.create()

        # Update form without adding curators
        form_data = {'name': 'test_group'}
        form = forms.GroupCuratorsForm(instance=group, data=form_data)

        ok_(form.is_valid())

        # Ensure that groups has no curators
        group = Group.objects.get(id=group.id)
        ok_(not group.curators.exists())