Hi,
I'm pretty new to Django, and I'm trying to create a few simple tests
for my project. I've created a very basic fixture and I'm trying to
just load it and see that the data is there. Nothing big. I've read
the documentation here:
http://docs.djangoproject.com/en/dev/topics/testing/
but I must be missing something because I can't get it to work. This
is how I have my app set up:
articles/
  models.py
  tests.py
  fixtures/
    articles-test.json

tests.py looks like this:
...
class ArticleTests(unittest.TestCase):
    fixtures = ['articles/fixtures/articles-test.json']

    def test_article_exists(self):
        a = Article.objects.get(pk=1)
        self.assertEquals(headline='foo')

When I run manage.py test articles, it's finding my test and running,
but it fails with
...
DoesNotExist: Article matching query does not exist.

One thing that is confusing me is that although the debug messages say
the test db tables are being created, etc, it says nothing about
whether it's loading my fixture, or whether it's trying and failing.
The documentation is unclear about exactly where the fixtures need to
be located, so I've tried putting them in a lot different places, with
no luck. I tried mangling the json file, so if it found it it should
throw a parse error, and still there was no difference, so I think the
problem must be that it's not loading the fixture, but I just can't
figure out how to point it in the right directions.

Any ideas? Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to