Skip to content

Commit

Permalink
Merge pull request #3544 from SFDO-Tooling/feature/disable-rate-limit…
Browse files Browse the repository at this point in the history
…ing-admin-api

Feature/disable rate limiting admin api
  • Loading branch information
jain-naman-sf authored Nov 28, 2023
2 parents 884740e + 1449f4b commit 4d434bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def safe_key() -> str:
],
'DEFAULT_THROTTLE_RATES': {
'anon': '4/second',
'user': '4/second'
'user': '4/second',
}

}
Expand Down
8 changes: 8 additions & 0 deletions metadeploy/adminapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class Meta:
class PlanTemplateViewSet(AdminAPIViewSet):
model_name = "PlanTemplate"
serializer_base = PlanTemplateSerializer
throttle_classes = []


class PlanFilter(filters.FilterSet):
Expand All @@ -150,22 +151,27 @@ class PlanViewSet(AdminAPIViewSet):
model_name = "Plan"
serializer_base = PlanSerializer
filterset_class = PlanFilter
throttle_classes = []


class PlanSlugViewSet(AdminAPIViewSet):
model_name = "PlanSlug"
throttle_classes = []


class VersionViewSet(AdminAPIViewSet):
model_name = "Version"
throttle_classes = []


class ProductCategoryViewSet(AdminAPIViewSet):
model_name = "ProductCategory"
throttle_classes = []


class AllowedListViewSet(AdminAPIViewSet):
model_name = "AllowedList"
throttle_classes = []


class AllowedListOrgSerializer(AdminAPISerializer):
Expand All @@ -175,6 +181,7 @@ class AllowedListOrgSerializer(AdminAPISerializer):
class AllowedListOrgViewSet(AdminAPIViewSet):
model_name = "AllowedListOrg"
serializer_base = AllowedListOrgSerializer
throttle_classes = []


class TranslationViewSet(viewsets.ViewSet):
Expand All @@ -194,6 +201,7 @@ class TranslationViewSet(viewsets.ViewSet):

permission_classes = [IsAPIUser]
model_name = "Translation"
throttle_classes = []

def partial_update(self, request, pk=None):
# Add or update a Translation record for each message
Expand Down
8 changes: 8 additions & 0 deletions metadeploy/adminapi/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ def test_list(self, admin_api_client, plan_factory):
"meta": {"page": {"total": 1}},
}

def test_throttle(self, admin_api_client):
url = "http://testserver/admin/rest/allowedlistorgs"
for i in range(0, 4):
response = admin_api_client.get(url)

response = admin_api_client.get(url)
assert response.status_code == 200

def test_retrieve(self, admin_api_client, step_factory):
step = step_factory()
plan = step.plan
Expand Down

0 comments on commit 4d434bc

Please sign in to comment.