﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28895	serialized_rollback = True causes an IntgrityError in LiveServerTestCase	Lyra2108	nobody	"Hey,

the project I am working on creates a set of required objects e.g. Groups,... within the  database migrations. I would like this data also do be present, when I use LiveServerTestCases. But if I run the simple example below the 2nd test fails while the first is successful.
If serialized_rollback = False, the tests fails like expected with a ""DoesNotExist: Group matching query does not exist."" exception.
But if it is set to True, the exception changes to an integrity exception:
{{{
IntegrityError: duplicate key value violates unique constraint ""django_content_type_app_label_45f3b1d93ec8c61c_uniq""
DETAIL:  Key (app_label, model)=(contenttypes, contenttype) already exists.
}}}

Testcase:
{{{
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.staticfiles.testing import StaticLiveServerTestCase


class Test(StaticLiveServerTestCase):
    serialized_rollback = True

    @classmethod
    def setUpClass(cls):
        super(Test, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(Test, cls).tearDownClass()

    def test_abc(self):
        group = Group.objects.get(name='groupname')
        assert group

    def test_def(self):
        group = Group.objects.get(name='groupname')
        assert group
}}}
"	Bug	closed	Testing framework	1.8	Normal	duplicate	LiveServerTestCase		Unreviewed	0	0	0	0	0	0
