Skip to content

Commit

Permalink
fix: updating serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
kiram15 committed Oct 7, 2024
1 parent 0024644 commit 06a2f5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion enterprise/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ class Meta:
model = models.EnterpriseGroup
fields = (
'enterprise_customer', 'name', 'uuid', 'applies_to_all_contexts',
'accepted_members_count', 'group_type')
'accepted_members_count', 'group_type', 'created')

accepted_members_count = serializers.SerializerMethodField()

Expand Down
16 changes: 16 additions & 0 deletions tests/test_enterprise/api/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8495,6 +8495,22 @@ def test_successful_update_group(self):
assert response.json().get('enterprise_customer') == str(new_uuid)
assert len(EnterpriseGroup.objects.filter(enterprise_customer=str(new_uuid))) == 1

def test_successful_update_group_name(self):
"""
Test patching an existing group record display name
"""
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>'
url = settings.TEST_SERVER + reverse(
'enterprise-group-detail',
kwargs={'pk': self.group_1.uuid},
)
old_name = self.group_1.name
new_name = "new_name"

request_data = {'name': new_name}
response = self.client.patch(url, data=request_data)
assert response.json().get('name') == str(new_name)

def test_successful_delete_group(self):
"""
Test deleting a group record
Expand Down

0 comments on commit 06a2f5a

Please sign in to comment.