def test_restore(self): with self.open_dump() as dump: dumprestore.load(dump) result = dumpdata.Command().handle(format='json', indent=4) + '\n' with self.open_fixture() as reference_fixture: self.assertTextEqual(reference_fixture.read(), result)
def test_restore(self): with self.open_dump() as dump: dumprestore.load(dump) backup_stdout = sys.stdout try: sys.stdout = BytesIO() call_command("dumpdata", format="json", indent=4, traceback=True) result = sys.stdout.getvalue() finally: sys.stdout.close() sys.stdout = backup_stdout with self.open_fixture() as reference_fixture: self.assertEqual(json.loads(reference_fixture.read()), json.loads(result))
def test_restore(self): with self.open_dump() as dump: dumprestore.load(dump) backup_stdout = sys.stdout try: sys.stdout = BytesIO() call_command('dumpdata', format='json', indent=4, traceback=True) result = sys.stdout.getvalue() finally: sys.stdout.close() sys.stdout = backup_stdout with self.open_fixture() as reference_fixture: self.assertEqual(json.loads(reference_fixture.read()), json.loads(result))
def handle_noargs(self, **options): from django_dumpdb.dumprestore import load load()