~lifeless/storm/bug-620615

« back to all changes in this revision

Viewing changes to tests/store/postgres.py

Merging fixes from James.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        self.database = create_database(os.environ["STORM_POSTGRES_URI"])
62
62
 
63
63
    def create_tables(self):
64
 
        connection = self.database.connect()
 
64
        connection = self.connection
65
65
        connection.execute("CREATE TABLE foo "
66
66
                           "(id SERIAL PRIMARY KEY,"
67
67
                           " title VARCHAR DEFAULT 'Default Title')")
86
86
 
87
87
    def drop_tables(self):
88
88
        StoreTest.drop_tables(self)
89
 
        connection = self.database.connect()
90
89
        for table in ["lst1", "lst2"]:
91
90
            try:
92
 
                connection.execute("DROP TABLE %s" % table)
93
 
                connection.commit()
 
91
                self.connection.execute("DROP TABLE %s" % table)
 
92
                self.connection.commit()
94
93
            except:
95
 
                connection.rollback()
 
94
                self.connection.rollback()
96
95
 
97
96
    def test_list_variable(self):
98
97
 
177
176
        self.database = create_database(os.environ["STORM_POSTGRES_URI"])
178
177
 
179
178
    def create_tables(self):
180
 
        connection = self.database.connect()
181
 
        connection.execute("CREATE TABLE foo "
182
 
                           "(id SERIAL PRIMARY KEY,"
183
 
                           " title VARCHAR DEFAULT 'Default Title')")
184
 
        connection.commit()
 
179
        self.connection.execute("CREATE TABLE foo "
 
180
                                "(id SERIAL PRIMARY KEY,"
 
181
                                " title VARCHAR DEFAULT 'Default Title')")
 
182
        self.connection.commit()