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

def test_nk_on_serialize(self):

    management.call_command(u'loaddata', u'forward_ref_lookup.json', verbosity=0)
    stdout = StringIO()
    management.call_command(u'dumpdata', u'fixtures_regress.book', u'fixtures_regress.person', u'fixtures_regress.store', verbosity=0, format=u'json', use_natural_keys=True, stdout=stdout)
    self.assertJSONEqual(stdout.getvalue(), u'[{"pk":    2,    "model":    "fixtures_regress.store",    "fields":    {"main":    null,    "name":    "Amazon"}},    {"pk":    3,    "model":    "fixtures_regress.store",    "fields":    {"main":    null,    "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"]}}]')
