'Regression for #11286
Ensure that dumpdata honors the default manager
Dump the current contents of the database as a JSON fixture'

def test_dumpdata_uses_default_manager(self):

    management.call_command(u'loaddata', u'animal.xml', verbosity=0)
    management.call_command(u'loaddata', u'sequence.json', verbosity=0)
    animal = Animal(name=u'Platypus', latin_name=u'Ornithorhynchus    anatinus', count=2, weight=2.2)
    animal.save()
    stdout = StringIO()
    management.call_command(u'dumpdata', u'fixtures_regress.animal', format=u'json', stdout=stdout)
    data = stdout.getvalue()
    data = re.sub(u'0{6,}\\d', u'', data)
    animals_data = sorted([{u'pk': 1, u'model': u'fixtures_regress.animal', u'fields': {u'count': 3, u'weight': 1.2, u'name': u'Lion', u'latin_name': u'Panthera    leo'}}, {u'pk': 10, u'model': u'fixtures_regress.animal', u'fields': {u'count': 42, u'weight': 1.2, u'name': u'Emu', u'latin_name': u'Dromaius    novaehollandiae'}}, {u'pk': animal.pk, u'model': u'fixtures_regress.animal', u'fields': {u'count': 2, u'weight': 2.2, u'name': u'Platypus', u'latin_name': u'Ornithorhynchus    anatinus'}}], key=(lambda x: x[u'pk']))
    data = sorted(json.loads(data), key=(lambda x: x[u'pk']))
    self.maxDiff = 1024
    self.assertEqual(data, animals_data)
