The database is cleared after each test method. So, in a new testcase your database is empty.
On Tue, 13 Aug 2019 at 00:34, Arulselvam K <tbone230...@gmail.com> wrote: > Have hosted the code @ "https://github.com/tbone230590/plib" > Here is the problem I have two models Book and IssuedBook, IssuedBook have > foreign key relation to Book object.Those models are defined @ > "/api/data/models" I have unit tests for testing those models and are > available @ "/api/unit_tests/models". > I am able to test Book model successfully. But I have a test for > IssuedBook model which is referring Book model is getting failed. > It seems cause of the problem is referring Book object created in > BookTestCase that was previously run. But I dont understand that why Book > record getting deleted after first testcase execution. > Could you educate me on this to solve the problem? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/cf28d61d-8582-4148-a14a-9349fdfcca8f%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/cf28d61d-8582-4148-a14a-9349fdfcca8f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFmXjSDqk2mahFjnKB-GJOAx6h9kJMGGo1aW29K%3DcOAk6mwP9g%40mail.gmail.com.