Load admin site for Unit Tests, add form tests
Review Request #10339 — Created Nov. 29, 2018 and submitted
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
pass.
- Change Summary:
-
Add in autodiscover() function, as well as add remaining form tests.
- Summary:
-
Test to see if admin site loads properly with ./test/runtests.pyLoad admin site models and URLs during Unit Tests, add new form tests.
- Description:
-
~ Test the ./test/runtests.py command, and test why the admin site doesn't properly load with this command.
~ 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. + + DefaultReviewer form tests, WebhookTargetAdmin form tests, and OauthAdmin
+ form tests were all added as well, to check that forms function as + expected. - Testing Done:
-
+ Running
./tests/runtests.py
returns no errors. The form tests added should+ pass. - Commit:
-
1b2423b54bc0b9ebf8fa0228cc3ae349d9640016def9a94e7a6e4e0187f361792e33381d31273131
Checks run (2 succeeded)
- Change Summary:
-
add in newline in test descriptions
- Commit:
-
def9a94e7a6e4e0187f361792e33381d3127313158f3da53e37486094b01f7e09cfa2cbf9779ac55
Checks run (2 succeeded)
- 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.