Load admin site for Unit Tests, add form tests

Review Request #10339 — Created Nov. 29, 2018 and updated

skaefer143
Review Board
master
58f3da5...
reviewboard, students

The admin site models and URLs were unable to be accessed during Unit Tests.
This meant that if a test attempted to access an admin model page, the
page would respond with a 404 error.

Adding django.contrib.admin.autodiscover() during initial test setup
loads all the admin UI models, so tests have access to admin URLS.

DefaultReviewer form tests, WebhookTargetAdmin form tests, and OauthAdmin
form tests were all added as well, to check that forms function as
expected.

Running ./tests/runtests.py returns no errors. The form tests added should
pass.

  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
skaefer143
skaefer143
brennie
  1. Excellent change.

  2. Summary doesn't need a period.

    Also, can you rewrite your summary to be ~52 characters?

  3. 
      
skaefer143
shoven
  1. 
      
  2. Nit in the description: "during initial test setup allows all the models for the admin UI to load" -> "during initial test setup loads all the admin UI models" (I think this is more direct so it is a bit clearer)

  3. 
      
skaefer143
Review request changed

Change Summary:

Updated Description

Description:

   

The admin site models and URLs were unable to be accessed during Unit Tests.

    This meant that if a test attempted to access an admin model page, the
    page would respond with a 404 error.

   
~  

Adding django.contrib.admin.autodiscover() during initial test setup allows

~   all the models for the admin UI to load, so tests have access to admin URLS.

  ~

Adding django.contrib.admin.autodiscover() during initial test setup

  ~ loads all the admin UI models, so tests have access to admin URLS.

   
   

DefaultReviewer form tests, WebhookTargetAdmin form tests, and OauthAdmin

    form tests were all added as well, to check that forms function as
    expected.

Loading...