Ticket #21457: ticket_21457_tests.diff

File ticket_21457_tests.diff, 2.0 KB (added by Baptiste Mispelon, 11 years ago)
  • new file tests/fixtures_regress/fixtures/fixture.with.several.periods.in.name.json

    diff --git a/tests/fixtures_regress/fixtures/fixture.with.several.periods.in.name.json b/tests/fixtures_regress/fixtures/fixture.with.several.periods.in.name.json
    new file mode 100644
    index 0000000..1693177
    - +  
     1[
     2    {
     3        "pk": "1",
     4        "model": "fixtures_regress.thingy",
     5        "fields": {
     6            "name": "Whatchamacallit"
     7        }
     8    }
     9]
  • new file tests/fixtures_regress/fixtures/fixture_with.period_in_name.json

    diff --git a/tests/fixtures_regress/fixtures/fixture_with.period_in_name.json b/tests/fixtures_regress/fixtures/fixture_with.period_in_name.json
    new file mode 100644
    index 0000000..1693177
    - +  
     1[
     2    {
     3        "pk": "1",
     4        "model": "fixtures_regress.thingy",
     5        "fields": {
     6            "name": "Whatchamacallit"
     7        }
     8    }
     9]
  • tests/fixtures_regress/tests.py

    diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
    index 4bfb45e..48f22dc 100644
    a b class TestFixtures(TestCase):  
    469469            verbosity=0,
    470470        )
    471471
     472    def test_fixture_name_with_period(self):
     473        """
     474        Fixtures can contain a period in their filename (#21457).
     475        """
     476        management.call_command(
     477            'loaddata',
     478            'fixture_with.period_in_name.json',
     479            verbosity=0,
     480        )
     481        queryset = Thingy.objects.all()
     482        self.assertQuerysetEqual(queryset, ['Whatchamacallit'], lambda m: m.name)
     483
     484    def test_fixture_name_with_several_periods(self):
     485        """
     486        Fixtures can contain several periods in their filename (#21457).
     487        """
     488        management.call_command(
     489            'loaddata',
     490            'fixture.with.several.periods.in.name.json',
     491            verbosity=0,
     492        )
     493        queryset = Thingy.objects.all()
     494        self.assertQuerysetEqual(queryset, ['Whatchamacallit'], lambda m: m.name)
     495
    472496
    473497class NaturalKeyFixtureTests(TestCase):
    474498
Back to Top