Fix role creation API not returning id of new role. GitLab issue #390.
Thanks to @lokeshmanmode for the find. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ XX (2017-XX-XX)
|
||||
- Add SANE scanner document source.
|
||||
- Added PDF orientation detection. GitLab issue #387.
|
||||
- Fix repeated permission list API URL. GitLab issue #389.
|
||||
- Fix role creation API endpoint not returning id. GitLab issue #390.
|
||||
|
||||
2.3 (2017-06-08)
|
||||
================
|
||||
|
||||
@@ -75,7 +75,7 @@ class WritableRoleSerializer(serializers.HyperlinkedModelSerializer):
|
||||
if self.permissions_pk_list:
|
||||
self._add_permissions(instance=instance)
|
||||
|
||||
return result
|
||||
return instance
|
||||
|
||||
def _add_groups(self, instance):
|
||||
instance.groups.add(
|
||||
|
||||
@@ -59,9 +59,12 @@ class PermissionAPITestCase(BaseAPITestCase):
|
||||
|
||||
def test_role_create_view(self):
|
||||
response = self._role_create_request()
|
||||
role = Role.objects.first()
|
||||
|
||||
self.assertEqual(response.status_code, 201)
|
||||
self.assertEqual(response.data, {'label': role.label, 'id': role.pk})
|
||||
self.assertEqual(Role.objects.count(), 1)
|
||||
self.assertEqual(Role.objects.first().label, TEST_ROLE_LABEL)
|
||||
self.assertEqual(role.label, TEST_ROLE_LABEL)
|
||||
|
||||
def _create_group(self):
|
||||
self.group = Group.objects.create(name=TEST_GROUP_NAME)
|
||||
|
||||
Reference in New Issue
Block a user