If you test an application providing some integration with Django Admin contrib,
there is a convenient admin_contrib argument you can pass to activate this contrib:
By default, all DB migrations are applied on test runs. Since that can be unnecessary and take a long time,
there is a migrate argument that you can always set to False:
Despite the fact that djangoapp is primarily aimed to reusable
Django applications testing one can use it also to test a project (a set of apps).
For that, pass a dotted settings module path into settings argument:
deftest_this(settings,request_client):# We use `settings` fixture to temporarily override# project settings.withsettings(DEBUG=True,MYVAR='someval'):# Now do some testing, with settings overridden....# And we use `request_client` fixture# to test our [AJAX] view.client=request_client(ajax=True)# We pass a tuple with a view name with arguments to not to bother with URL.response=client.get(('someview',{'somearg':'one','otherarg':33}))...# See fixtures documentation for more fixtures.
Sometimes your app may provide tooling for other apps (say it automatically imports modules from them,
or provides some urlpatterns). If so, you may want to simulate that other application in your tests.
You can easily do that by adding testapp package under your test directory (this will be automatically
added to INSTALLED_APPS and treated by Django just as any application package)::