views:

42

answers:

1

I have an app called pta.apps.users which is loaded in the Loaded apps setting in my settings.py.

The app works fine, I now want to test it and have placed json files in the fixtures directory inside my users app.

I have a test which runs fine but the fixtures wont load.

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')

I just get No fixtures found. in my output. I am using Django 1.2.1. Any help would be appreciatted.

+1  A: 

where did you placed your fixtures? The fixtures should placed in your app directory:

MyApp/fixtures/user.json

Or you hav to specify a external fixtures directory in your settings.py:

FIXTURE_DIRS = (
    'external_fixtures/',
)
maersu
yes that is where I have them MyApp/fixtures/user.jsonCheersRichard
Richard
what is weird is that I can load data directly from loaddata using python manage.py loaddata user.json
Richard