Edgewall Software

Ticket #7600: testcase_quoting_multiple_indexes.patch

File testcase_quoting_multiple_indexes.patch, 1020 bytes (added by Felix Schwarz <felix.schwarz@…>, 3 years ago)

a test case to ensure that the bug does not creep in again

  • trac/db/tests/postgres_test.py

     
    6565        self.assertEqual('CREATE TABLE "foo" ( "my name" text)', sql_commands[0]) 
    6666        index_sql = 'CREATE INDEX "foo_my name_idx" ON "foo" ("my name")' 
    6767        self.assertEqual(index_sql, sql_commands[1]) 
     68     
     69    def test_quote_index_declaration_for_multiple_indexes(self): 
     70        table = Table('foo') 
     71        table[Column('a'), Column('b'),  
     72              Index(['a', 'b'])] 
     73        sql_generator = PostgreSQLConnector(self.env).to_sql(table) 
     74        sql_commands = self._normalize_sql(sql_generator) 
     75        self.assertEqual(2, len(sql_commands)) 
     76        self.assertEqual('CREATE TABLE "foo" ( "a" text, "b" text)', sql_commands[0]) 
     77        index_sql = 'CREATE INDEX "foo_a_b_idx" ON "foo" ("a","b")' 
     78        self.assertEqual(index_sql, sql_commands[1]) 
    6879 
    6980 
    7081def suite():