Beispiel #1
0
 def get_postgres_connection(
         cls):  # TODO externalize use - test schema to initialize
     db_url = "postgres:host='localhost' dbname='sales_reporting' user='******' password='******'"  # TODO externalize
     cls.connection = ConnectionHelper.get_connection(db_url)
     cursor = cls.connection.cursor()
     schema = "integration_test"
     cursor.execute("create schema %s" % schema)
     cursor.execute("set schema '%s'" % schema)
     return cls.connection
Beispiel #2
0
    def setUp(self):
        # db_url = os.getenv(self.POSTGRES_TEST_URL)
        if self.dialect == dialects.DIALECT_POSTGRES:
            db_url = "postgres:host='localhost' dbname='sales_reporting_db' user='******' password='******'"
            # TODO externalize
            test_schema = self.TEST_SCHEMA
        elif self.dialect == dialects.DIALECT_SQLITE:
            db_url = "sqlite::memory:"
            test_schema = None
        else:
            raise Exception("unsupported dialect %s" % self.dialect)

        message = "Skipping test as %s environment variable not set" % self.POSTGRES_TEST_URL
        if not db_url:
            logging.warning(message)
            self.skipTest(message)

        self.connection = ConnectionHelper.get_connection(db_url)
        SchemaInitter(self.connection, test_schema).process()
        ut_condition_init(self.connection).process()
        sr_data_init(self.connection).process()
def get_test_postgres_connection():
    db_url = "postgres:host='localhost' dbname='sales_reporting_db' user='******' password='******'"  # TODO externalize
    return ConnectionHelper.get_connection(db_url)