I have a mysql database defined in settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME':'<name>',
'USER':'<user>',
'PASSWORD':'<password>'
}
}
Now I need to create a test database for my unittesting. Where do I need to mention the settings of test database or I don't have to mention them at all?
For testing when I do:
python manage.py test my_app
it says:
Creating test database for alias 'default'...
Skipping creation of NoticeTypes as notification app not found
E
======================================================================
ERROR: test_update_quiz (toolbox.tests.TestQuizCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/2.0/site/toolbox/tests.py", line 20, in test_update_quiz
akit = AssignmentKit.objects.get(pk = akit_id)
File "/usr/local/lib/python2.7/site-packages/django/db/models/manager.py", line 131, in get
return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get
% self.model._meta.object_name)
DoesNotExist: AssignmentKit matching query does not exist.
----------------------------------------------------------------------
Ran 1 test in 0.003s
FAILED (errors=1)
Destroying test database for alias 'default'...
The error the test gives is wrong. Because I do have that object in my database I checked from ORM. Why is this error coming? are my database not properly linked?