我有一個名爲pta.apps.users的應用程序,它在我的settings.py中加載的應用程序設置中加載。無法在Django測試中加載fixture數據
該應用程序工作正常,我現在想測試它,並已將json文件放入我的用戶應用程序內的fixtures目錄中。
我有一個測試運行良好,但夾具不會加載。
from django.test import TestCase
from django.test.client import Client
from BeautifulSoup import BeautifulSoup
class SimpleTest(TestCase):
fixtures = ['user.json']
def setUp(self):
self.c = Client()
def test_parse_html(self):
response = self.c.get('/users/login/', follow=True)
soup = BeautifulSoup(response.content)
self.assertEquals(soup.h1.renderContents(), 'Entrance')
我剛在輸出中得到了No fixtures found.
。我正在使用Django 1.2.1。任何幫助將升值。
是的,這是我讓他們MyApp的/夾具/ user.json 乾杯 理查德 – Richard 2010-07-01 21:59:15
是什麼奇怪的是,我可以直接從loaddata使用python manage.py loaddata user.json加載數據 – Richard 2010-07-03 00:18:40