示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    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))
示例#4
0
    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))
示例#5
0
 def handle_noargs(self, **options):
     from django_dumpdb.dumprestore import load
     load()