def test_drop(self):

        self.dbname1 = dbutil.random_name('test_drop_db')

        # Create a new database.
        dbutil.TESTSERVER.create(self.dbname1, self.SAVE_DIR, self.SAVE_FILE)

        # Connect to the newly created database, to make sure it is
        # there, and to create a pgbouncer pool.
        conn = dbutil.TESTSERVER.connect(self.dbname1)
        try:
            conn = dbutil.ConnectionWrapper(conn)
            dbname = conn.database_name()
            self.assertEqual(dbname, self.dbname1)
        finally:
            conn.close()

        # Now drop the database...
        dbutil.TESTSERVER.drop(self.dbname1)

        # and make sure it is gone.
        maint_conn = dbutil.TESTSERVER.connect(self.MAINTENANCE_DB,
                                               superuser=True)
        try:
            maint_conn = dbutil.MaintenanceWrapper(maint_conn)
            self.assertFalse(maint_conn.exists(self.dbname1),
                             "Dropped database still seems to be there.")
        finally:
            maint_conn.close()
Test ability to drop a database
dataset/ETHPy150Open GeoscienceAustralia/agdc/tests/test_dbutil.py/TestServer.test_drop