def test_it_does_not_raise_if_group_type_is_same(self, group_data, pyramid_csrf_request, org, user_svc): group = mock.Mock(type='open') group_data['group_type'] = 'open' schema = CreateAdminGroupSchema().bind(request=pyramid_csrf_request, group=group, user_svc=user_svc, organizations={org.pubid: org}) schema.deserialize(group_data)
def test_it_raises_if_group_type_changed(self, group_data, pyramid_csrf_request, org, user_svc): group = mock.Mock(type='open') group_data['group_type'] = 'restricted' schema = CreateAdminGroupSchema().bind(request=pyramid_csrf_request, group=group, user_svc=user_svc, organizations={org.pubid: org}) with pytest.raises(colander.Invalid, match='Changing group type'): schema.deserialize(group_data)