Skip to content

Commit

Permalink
Delete related methods should not be allowed in RPM API
Browse files Browse the repository at this point in the history
JIRA: PDC-936
  • Loading branch information
ycheng-aa committed Aug 17, 2015
1 parent 7d3c00a commit f1722e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions pdc/apps/package/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ def test_bulk_update_patch(self):
self.assertEqual(response.data.get("linked_releases"), ['release-1.0'])
self.assertNumChanges([1])

def test_delete_rpm_should_not_be_allowed(self):
url = reverse('rpms-detail', args=[1])
response = self.client.delete(url, format='json')
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)

def test_bulk_delete_rpms_should_not_be_allowed(self):
url = reverse('rpms-list')
response = self.client.delete(url, [1, 2], format='json')
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)


class ImageRESTTestCase(APITestCase):
fixtures = [
Expand Down
7 changes: 6 additions & 1 deletion pdc/apps/package/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
from . import filters


class RPMViewSet(pdc_viewsets.PDCModelViewSet):
class RPMViewSet(pdc_viewsets.StrictQueryParamMixin,
pdc_viewsets.ChangeSetCreateModelMixin,
pdc_viewsets.ChangeSetUpdateModelMixin,
mixins.RetrieveModelMixin,
mixins.ListModelMixin,
viewsets.GenericViewSet):
"""
API endpoint that allows RPMs to be viewed.
"""
Expand Down

0 comments on commit f1722e1

Please sign in to comment.