Fix group creation
Fixes an error that was preventing groups from being created. Groups did require a list of permissions which is now optional
This commit is contained in:
parent
a2d561f667
commit
5f8e64140a
@ -159,7 +159,9 @@ class GroupSerializer(ModelSerializer):
|
|||||||
Serializer for django.contrib.auth.models.Group objects.
|
Serializer for django.contrib.auth.models.Group objects.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
permissions = PermissionRelatedField(many=True, queryset=Permission.objects.all())
|
permissions = PermissionRelatedField(
|
||||||
|
many=True, queryset=Permission.objects.all(), required=False
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Group
|
model = Group
|
||||||
|
@ -705,6 +705,18 @@ class GroupCreate(TestCase):
|
|||||||
Tests creation of groups via REST API.
|
Tests creation of groups via REST API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def test_creation_simple(self):
|
||||||
|
self.client.login(username="admin", password="admin")
|
||||||
|
|
||||||
|
response = self.client.post(
|
||||||
|
reverse("group-list"), {"name": "Test name ldr59xq2mvt96rdayhju"},
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||||
|
self.assertTrue(
|
||||||
|
Group.objects.filter(name="Test name ldr59xq2mvt96rdayhju").exists()
|
||||||
|
)
|
||||||
|
|
||||||
def test_creation(self):
|
def test_creation(self):
|
||||||
self.client.login(username="admin", password="admin")
|
self.client.login(username="admin", password="admin")
|
||||||
# This contains two valid permissions of the users app.
|
# This contains two valid permissions of the users app.
|
||||||
|
Loading…
Reference in New Issue
Block a user