示例#1
0
 def test2_cli_db2server(self):
     from cathub.postgresql import CathubPostgreSQL
     from cathub.cli import db2server
     db = CathubPostgreSQL(user='******')
     con = db._connect()
     db._initialize(con)
     db.truncate_schema()
     runner = CliRunner()
     runner.invoke(db2server,
                   ['--dbuser=postgres', 'aayush/MontoyaChallenge2015.db'])
示例#2
0
    def test3_upload(self):
        """Ensure postgres database is empty"""
        db = CathubPostgreSQL(user='******')
        con = db._connect()
        db._initialize(con)
        db.truncate_schema()
        con.commit()
        con.close()

        db2server.main(
            '{path}/aayush/MontoyaChallenge2015.db'.format(path=path),
            user='******')
        if os.path.exists(
                '{path}/aayush/MontoyaChallenge2015.db'.format(path=path)):
            os.remove(
                '{path}/aayush/MontoyaChallenge2015.db'.format(path=path))