I am trying to test my Django app which runs on PostGIS database, in which the information is followed is.
Normally I create a new database by copying a template:
(as user postgres)
createdb -T template_postgis -O Lizard test_geodjango2 When I run ./ manage.py test , I get the following message:
Test Creating database ... An error occurred Test database: Permission denied to create database
If you want to try to delete test database 'test_geodjango2' Type 'yes' or cancel to 'cancel':
It is possible that your DATABASE_USER is not allowed to create a new database / schema
edit
If you read the source for the zango test command, you will see that it always creates a test database, in addition to it to refer to this test database Change your settings Fixed.
See this:
What you should use is how we do it here.
-
Create a "stability" from your template database. Use the
manage.py dumpdatecommand to create a JSON file with all your template data [hint,- indent = 2option lets you read JSON that lets you edit -
This is a
Refer to the fixtures file in your testes class definition . This test will load stability before running.
class AnimalTestCase (TestCase): fixtures = ['Mammals. Jason ',' birds'] def testFluffyAnimals (self): etc.
fixtures change your template database
Comments
Post a Comment