Skip to content

Commit

Permalink
fix: updating serializer (#2260)
Browse files Browse the repository at this point in the history
* fix: updating serializer

* fix: bumping version
  • Loading branch information
kiram15 authored Oct 9, 2024
1 parent 4731169 commit ae70aa4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Unreleased
----------
* nothing unreleased

[4.27.3]
---------
* fix: Updating the EnterpriseGroup serializer with created variable

[4.27.2]
---------
* fix: updates `get_all_learners` to remove `_get_implicit_group_members`
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.27.2"
__version__ = "4.27.3"
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
22 changes: 18 additions & 4 deletions tests/test_enterprise/api/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8063,7 +8063,7 @@ def test_successful_retrieve_group(self):
"""
Test retrieving a single group record
"""
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>'
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>/'
url = settings.TEST_SERVER + reverse(
'enterprise-group-detail',
kwargs={'pk': self.group_1.uuid},
Expand Down Expand Up @@ -8475,7 +8475,7 @@ def test_successful_update_group(self):
"""
Test patching an existing group record
"""
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>'
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>/'
url = settings.TEST_SERVER + reverse(
'enterprise-group-detail',
kwargs={'pk': self.group_1.uuid},
Expand All @@ -8494,12 +8494,26 @@ 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},
)
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
"""
group_to_delete_uuid = EnterpriseGroupFactory(enterprise_customer=self.enterprise_customer).uuid
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>'
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>/'
url = settings.TEST_SERVER + reverse(
'enterprise-group-detail',
kwargs={'pk': group_to_delete_uuid},
Expand Down Expand Up @@ -8741,7 +8755,7 @@ def test_patch_with_bad_request_customer_to_change_to(self):
Test that the PATCH endpoint will not allow the user to update a group to a customer that the requester
doesn't have access to
"""
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>'
# url: 'http://testserver/enterprise/api/v1/enterprise_group/<group uuid>/'
url = settings.TEST_SERVER + reverse(
'enterprise-group-detail',
kwargs={'pk': self.group_1.uuid},
Expand Down

0 comments on commit ae70aa4

Please sign in to comment.