mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 10:27:34 -02:30
remove extra validation on project.organization, enforced in UI, but allowed in API
This commit is contained in:
@@ -899,12 +899,6 @@ class ProjectSerializer(UnifiedJobTemplateSerializer, ProjectOptionsSerializer):
|
|||||||
args=(obj.last_update.pk,))
|
args=(obj.last_update.pk,))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def validate(self, attrs):
|
|
||||||
if 'organization' not in attrs or type(attrs['organization']) is not Organization:
|
|
||||||
raise serializers.ValidationError('Missing organization')
|
|
||||||
return super(ProjectSerializer, self).validate(attrs)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectPlaybooksSerializer(ProjectSerializer):
|
class ProjectPlaybooksSerializer(ProjectSerializer):
|
||||||
|
|
||||||
|
|||||||
@@ -116,9 +116,3 @@ def test_create_project(post, organization, org_admin, org_member, admin, rando)
|
|||||||
assert Project.objects.filter(name='Project %d' % i, organization=organization).exists()
|
assert Project.objects.filter(name='Project %d' % i, organization=organization).exists()
|
||||||
else:
|
else:
|
||||||
assert not Project.objects.filter(name='Project %d' % i, organization=organization).exists()
|
assert not Project.objects.filter(name='Project %d' % i, organization=organization).exists()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db(transaction=True)
|
|
||||||
def test_cant_create_project_without_org(post, organization, org_admin, org_member, admin, rando):
|
|
||||||
assert post(reverse('api:project_list'), { 'name': 'Project foo', }, admin).status_code == 400
|
|
||||||
assert post(reverse('api:project_list'), { 'name': 'Project foo', 'organization': None}, admin).status_code == 400
|
|
||||||
|
|||||||
Reference in New Issue
Block a user