Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppression de la redirection temporaire approvals:redirect_to_employee vers employees:detail #5496

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion itou/www/approvals_views/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

urlpatterns = [
# PASS IAE
path("detail/<int:pk>", views.approval_detail_redirect_to_employee_view, name="redirect_to_employee"),
path("details/<int:pk>", views.ApprovalDetailView.as_view(), name="details"),
path("display/<int:approval_id>", views.ApprovalPrintableDisplay.as_view(), name="display_printable_approval"),
path("list", views.ApprovalListView.as_view(), name="list"),
Expand Down
13 changes: 1 addition & 12 deletions itou/www/approvals_views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.db import IntegrityError
from django.db.models import Max, Prefetch
from django.http import Http404, HttpResponseBadRequest, HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.utils import timezone
from django.views import View
Expand Down Expand Up @@ -73,17 +73,6 @@ def get_context_data(self, **kwargs):
return context


# TODO(xfernandez): remove this redirect view in a few weeks
def approval_detail_redirect_to_employee_view(request, pk):
siae = get_current_company_or_404(request)

if not siae.is_subject_to_eligibility_rules:
raise PermissionDenied

approval = get_object_or_404(Approval.objects.select_related("user"), pk=pk)
return redirect("employees:detail", public_id=approval.user.public_id)


class ApprovalListView(ApprovalBaseViewMixin, ListView):
paginate_by = 10
paginator_class = ItouPaginator
Expand Down
19 changes: 0 additions & 19 deletions tests/www/approvals_views/test_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,6 @@
from tests.utils.test import assertSnapshotQueries, parse_response_to_soup


class TestRedirectToEmployeeView:
def test_anonymous_user(self, client):
approval = ApprovalFactory()
url = reverse("approvals:redirect_to_employee", kwargs={"pk": approval.pk})
response = client.get(url)
assertRedirects(response, reverse("account_login") + f"?next={url}")

def test_redirect(self, client):
membership = CompanyMembershipFactory()
client.force_login(membership.user)
approval = ApprovalFactory()
response = client.get(reverse("approvals:redirect_to_employee", kwargs={"pk": approval.pk}))
assertRedirects(
response,
reverse("employees:detail", kwargs={"public_id": approval.user.public_id}),
fetch_redirect_response=False,
)


class TestApprovalDetailView:
def test_anonymous_user(self, client):
approval = JobApplicationFactory(with_approval=True).approval
Expand Down