Hi,

I encounter strange differences when I run my test code against sqlite3 and
against mysql. I am about to test it with Postgresql later today. My models
make heavy use of generic relationships. And everytime I run "./manage.py
test" with the mysql backend I receive the following error.

IntegrityError: (1452, 'Cannot add or update a child row: a foreign key
constraint fails (`test_redweb_crossmedia/auth_permission`, CONSTRAINT
`content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`)
REFERENCES `django_content_type` (`id`))')

This is one example testcode I use.

class DocumentTests(TestCase):

    def setUp(self):
        self.user = User.objects.get_or_create(username='test',
password='test')[0]

    def test_creation_of_attachments_and_the_manager(self):
        test_document = File(open(path.join(BASEDIR, 'test.pdf'), 'rb'))
        doc = Document(content_object=self.user, created_by=self.user)
        doc.file.save('test.pdf', test_document)
        [...]
        doc.delete()

I get_or_create an user, create some kind of attachment class, setup a
generic relationship between both and thats it. In sqlite3 this works like a
charm. Can anybody drop me a helpful tip? The app itself works like
expected, but I would appreciate to have working testcode. :)

Best regards,
Oliver

-- 
Oliver Andrich <[EMAIL PROTECTED]> --- http://oliverandrich.net/

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

Reply via email to