Ticket #20820: 20820-test.diff

File 20820-test.diff, 1.6 KB (added by Tim Graham, 11 years ago)

regression test

  • new file tests/fixtures_regress/fixtures/special-article.json

    diff --git a/tests/fixtures_regress/fixtures/special-article.json b/tests/fixtures_regress/fixtures/special-article.json
    new file mode 100644
    index 0000000..435ceb7
    - +  
     1[
     2    {
     3        "pk": 1,
     4        "model": "fixtures_regress.specialarticle",
     5        "fields": {
     6            "title": "Article Title 1",
     7            "channels": []
     8        }
     9    }
     10]
  • tests/fixtures_regress/models.py

    diff --git a/tests/fixtures_regress/models.py b/tests/fixtures_regress/models.py
    index 9909672..ab4fb87 100644
    a b class Article(models.Model):  
    7070        ordering = ('id',)
    7171
    7272
     73# Subclass of a model with a ManyToManyField for test_ticket_20820
     74class SpecialArticle(Article):
     75    pass
     76
     77
    7378# Models to regression test #11428
    7479@python_2_unicode_compatible
    7580class Widget(models.Model):
  • tests/fixtures_regress/tests.py

    diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
    index f917b21..e2985d3 100644
    a b class TestFixtures(TestCase):  
    444444        self.assertTrue("No fixture 'this_fixture_doesnt_exist' in" in
    445445            force_text(stdout_output.getvalue()))
    446446
     447    def test_ticket_20820(self):
     448        """
     449        Regression for ticket #20820 -- loaddata on a model that inherits
     450        from a model with a M2M shouldn't blow up.
     451        """
     452        management.call_command(
     453            'loaddata',
     454            'special-article.json',
     455            verbosity=0,
     456        )
     457
    447458
    448459class NaturalKeyFixtureTests(TestCase):
    449460
Back to Top