def test_client_detail_view_with_invalid_customer(self):
self.client.login(username="test_user", password="password123")
response = self.client.get("/customer/123456/")
self.assertEqual(response.status_code, 404)
AssertionError: 200 != 404
handler404 = SystemView.as_view(template_name="pages/system/not-found.html", status=404)
class ClientListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
permission_required = "sop.view_client"
permission_denied_message = "You do not have permission to view client information."
template_name = "pages/sop/client_list.html"
context_object_name = "clients"
model = Client
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context = KTLayout.init(context)
return context
path("clients", ClientListView.as_view(), name="client-list"),
def test_client_detail_view_with_invalid_commercial_client(self):
self.client.login(username="sop_user", password="P@55w0Rd")
response = self.client.get("/sop/client/com/123456/")
self.assertEqual(response.status_code, 404)
handler404 = SystemView.as_view(template_name="pages/system/not-found.html", status=404)
handler500 = SystemView.as_view(template_name="pages/system/error.html", status=500)
return HttpResponseNotFound("<h1>User not found</h1>")