'Check that natural key requirements are taken into account
when serializing models'

def test_nk_on_serialize(self):

    management.call_command('loaddata', 'forward_ref_lookup.json', verbosity=0, commit=False)
    stdout = StringIO()
    management.call_command('dumpdata', 'fixtures_regress.book', 'fixtures_regress.person', 'fixtures_regress.store', verbosity=0, format='json', use_natural_keys=True, stdout=stdout)
    self.assertEqual(stdout.getvalue(), '[{"pk":    2,    "model":    "fixtures_regress.store",    "fields":    {"name":    "Amazon"}},    {"pk":    3,    "model":    "fixtures_regress.store",    "fields":    {"name":    "Borders"}},    {"pk":    4,    "model":    "fixtures_regress.person",    "fields":    {"name":    "Neal    Stephenson"}},    {"pk":    1,    "model":    "fixtures_regress.book",    "fields":    {"stores":    [["Amazon"],    ["Borders"]],    "name":    "Cryptonomicon",    "author":    ["Neal    Stephenson"]}}]')
