Add an isolated PHP smoke test for hosting plans

This commit is contained in:
parkel committed 2026-11-19 21:35:59 +01:00
1 parent 64ee6ddcba
commit 374408f8c7
14 files changed
+253 -6

No files matched your search

+22
View File
@@ -1,11 +1,13 @@
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db.models import Q
from django.http import HttpResponse
from django.shortcuts import redirect
from django.views import View
from django.views.generic import CreateView, DetailView, ListView, UpdateView
from django.views.generic.detail import SingleObjectMixin
from .models import HostingAccount, WebProvisioningPlan
from .web_node import build_web_smoke_bundle
VIEW_ACCOUNTS = "hosting.view_hostingaccount"
CHANGE_ACCOUNTS = "hosting.change_hostingaccount"
@@ -93,3 +95,23 @@ class PlanDetail(PermissionRequiredMixin, DetailView):
permission_required = VIEW_PLANS
template_name = "hosting/plan_detail.html"
context_object_name = "plan"
class DownloadWebSmokeBundle(PlanDetail):
def render_to_response(self, context, **response_kwargs):
plan = self.object
if not plan.can_export:
return HttpResponse(
"Request a completed Apache preview for the current account domain.",
status=409,
content_type="text/plain",
)
return HttpResponse(
build_web_smoke_bundle(plan),
content_type="application/x-tar",
headers={
"Cache-Control": "private, no-store",
"Content-Disposition": f'attachment; filename="coulobre-web-plan-{plan.pk}.tar"',
},
)