1 | import unittest
|
---|
2 |
|
---|
3 | from nmy.qsrftest.models import Vocabulary, Term
|
---|
4 |
|
---|
5 | class QsrfTestCase(unittest.TestCase):
|
---|
6 |
|
---|
7 | def test_qsrf(self):
|
---|
8 | v = Vocabulary.objects.create()
|
---|
9 |
|
---|
10 | # Check if the new vocabulary has a root term
|
---|
11 | self.failUnless(v.root != None,
|
---|
12 | 'A newly created vocabulary must have a root term.')
|
---|
13 |
|
---|
14 | # Check that the root item is associated to the vocabulary.
|
---|
15 | self.failUnlessEqual(v, v.root.vocabulary,
|
---|
16 | 'The vocabulary of the implicity created root term must'\
|
---|
17 | 'be set. %s != %s'\
|
---|
18 | % (v, v.root.vocabulary))
|
---|
19 |
|
---|
20 | # Check cyclic correctness. This test succeeds with r7433 and fails
|
---|
21 | # with r7599 when the ``vocabulary`` field is referenced in the
|
---|
22 | # term's save() method.
|
---|
23 | self.failUnlessEqual(v.root, v.root.vocabulary.root)
|
---|
24 |
|
---|