Esempio n. 1
0
    def test_dump(self, dumpfile, dryrun):
        args = self.Args({'dry_run': dryrun, 'dumpfile': dumpfile})
        db = self.PartialMockDb(args, None)
        self.mox.StubOutWithMock(omego.fileutils, 'timestamp_filename')
        self.mox.StubOutWithMock(db, 'get_db_args_env')
        self.mox.StubOutWithMock(db, 'pgdump')

        if not dumpfile:
            db.get_db_args_env().AndReturn(self.create_db_test_params())

            dumpfile = 'omero-database-name-00000000-000000-000000.pgdump'
            omego.fileutils.timestamp_filename('omero-database-name',
                                               'pgdump').AndReturn(dumpfile)

        if not dryrun:
            db.pgdump('-Fc', '-f', dumpfile).AndReturn('')

        self.mox.ReplayAll()

        db.dump()
        self.mox.VerifyAll()
Esempio n. 2
0
File: test_db.py Progetto: ome/omego
    def test_dump(self, dumpfile, dryrun):
        args = self.Args({'dry_run': dryrun, 'dumpfile': dumpfile})
        db = self.PartialMockDb(args, None)
        self.mox.StubOutWithMock(omego.fileutils, 'timestamp_filename')
        self.mox.StubOutWithMock(db, 'get_db_args_env')
        self.mox.StubOutWithMock(db, 'pgdump')

        if not dumpfile:
            db.get_db_args_env().AndReturn(self.create_db_test_params())

            dumpfile = 'omero-database-name-00000000-000000-000000.pgdump'
            omego.fileutils.timestamp_filename(
                'omero-database-name', 'pgdump').AndReturn(dumpfile)

        if not dryrun:
            db.pgdump('-Fc', '-f', dumpfile).AndReturn('')

        self.mox.ReplayAll()

        db.dump()
        self.mox.VerifyAll()