I have written tests for a Django project that i am working on, but one particular fixture fails to load. The fixture is generated using dumpdata and i havent fiddled with it at all. I can load the data using manage.py on that fixture without errors. I have verified that the data actually loaded using shell and querying the data. This is driving me nuts, any help would be much appreciated.
Here is my test file (irrelevant portions removed):
class ViewsFromUrls(TestCase):
fixtures = [
'centers/fixtures/test_data.json',
'intranet/fixtures/test_data.json',
'training/fixtures/test_data.json', #The one that fails to load
]
def setUp(self):
self.c = Client()
self.c.login(username='USER', password='PASS')
...
def test_ViewBatch(self):
b = Batch.objects.all()[0].ticket_number
response = self.c.get(reverse('training.views.view_batch', kwargs={'id':b}))
self.assertTrue(response.status_code, 200)
...
Import the TestCase from django.test
:
from django.test import TestCase
class test_something(TestCase):
fixtures = ['one.json', 'two.json']
...
import unittest
import django.utils.unittest
import django.test
That's a day of frustration right there. Stop complaining - it's in the docs :-/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With