Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8656713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:20:45+00:00 2026-06-12T15:20:45+00:00

I write my handler for server errors and define it at root urls.py: handler500

  • 0

I write my handler for server errors and define it at root urls.py:
handler500 = ‘myhandler’
And I want to write unittest for testing how it works. For testing I write view with error and define it in test URLs configuration, when I make request to this view in browser I see my handler and receive status code 500, but when I launch test that make request to this view I see stack trace and my test failed. Have you some ideas for testing handler500 by unittests?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:20:47+00:00Added an answer on June 12, 2026 at 3:20 pm

    What you want to do here is integration testing; unit-tests won’t be the appropriate tools for it.

    Django includes support for using famous live browser testing tools such as Selenium.

    As you pointed out and for your specific case, it is indeed pretty complicated to retrieve the status code for a page using Selenium, you might therefore want to use a simpler approach:

    1. Use a LiveServerTestCase
    2. Use a python HTTP client such as requests to access the test page
    3. Check that the test page does generate an HTTP 500 error
    4. Check that the test page contains the expected content.

    If you want to test some JS on the test page, then use Selenium for that part, in combination of requests to test the status.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to handle all server-side errors with jQuery on client side. For this
I need help with how to write a SQL Server 2005 query to handle
i write row click handler: $('#mTable tr').unbind().live('click', function() { //specialFunction() }); specialFunction must not
In my 'myClass' class, I am using Reflection.Emit to dynamically write an event handler
I need to write a basic authentication handler. In my onAuthenticationFailure , just for
I have to write an application that is essentially a proxy server to handle
I want to write an IErrorHandler implementation that will handle AuthenticationException instances (a proprietary
I am writing a netty client and server application that will write JVM GC
I have this exception: Server Error in '/datalab' Application. Request timed out. Description: An
I'm trying to create a wrapper/handler that will be called on the Apache server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.