Changeset 820 for trunk/tests


Ignore:
Timestamp:
Feb 5, 2016, 9:04:31 AM (4 years ago)
Author:
cito
Message:

Skip test for privileges when running as superuser

It's not possible to test for missing privileges as a superuser
because superusers always have all privileges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_classic_dbwrapper.py

    r817 r820  
    10721072    def testGetAttnamesWithRegtypes(self):
    10731073        get_attnames = self.db.get_attnames
    1074         self.createTable('test_table',
    1075                          ' n int, alpha smallint, beta bool,'
    1076                          ' gamma char(5), tau text, v varchar(3)')
     1074        self.createTable('test_table', 'n int, alpha smallint, beta bool,'
     1075            ' gamma char(5), tau text, v varchar(3)')
    10771076        use_regtypes = self.db.use_regtypes
    10781077        regtypes = use_regtypes()
     
    10901089    def testGetAttnamesWithoutRegtypes(self):
    10911090        get_attnames = self.db.get_attnames
    1092         self.createTable('test_table',
    1093                          ' n int, alpha smallint, beta bool,'
    1094                          ' gamma char(5), tau text, v varchar(3)')
     1091        self.createTable('test_table', 'n int, alpha smallint, beta bool,'
     1092            ' gamma char(5), tau text, v varchar(3)')
    10951093        use_regtypes = self.db.use_regtypes
    10961094        regtypes = use_regtypes()
     
    11511149            self.assertEqual(r, 'i2 i4 i8 d f4 f8 m v4 c4 t')
    11521150        table = 'test table for get_attnames'
    1153         self.createTable(table,
    1154                          ' n int, alpha smallint, v varchar(3),'
    1155                          ' gamma char(5), tau text, beta bool')
     1151        self.createTable(table, 'n int, alpha smallint, v varchar(3),'
     1152                ' gamma char(5), tau text, beta bool')
    11561153        r = get_attnames(table)
    11571154        self.assertIsInstance(r, OrderedDict)
     
    11901187        self.assertEqual(r, 'i2 i4 i8 d f4 f8 m v4 c4 t')
    11911188        table = 'test table for get_attnames'
    1192         self.createTable(table,
    1193                          ' n int, alpha smallint, v varchar(3),'
    1194                          ' gamma char(5), tau text, beta bool')
     1189        self.createTable(table, 'n int, alpha smallint, v varchar(3),'
     1190                ' gamma char(5), tau text, beta bool')
    11951191        r = get_attnames(table)
    11961192        self.assertIsInstance(r, AttrDict)
     
    12161212        self.assertEqual(can('test', 'update'), True)
    12171213        self.assertEqual(can('test', 'delete'), True)
     1214        self.assertRaises(pg.ProgrammingError, can, 'test', 'foobar')
     1215        self.assertRaises(pg.ProgrammingError, can, 'table_does_not_exist')
     1216        r = self.db.query('select rolsuper FROM pg_roles'
     1217            ' where rolname=current_user').getresult()[0][0]
     1218        if not pg.get_bool():
     1219            r = r == 't'
     1220        if r:
     1221            self.skipTest('must not be superuser')
    12181222        self.assertEqual(can('pg_views', 'select'), True)
    12191223        self.assertEqual(can('pg_views', 'delete'), False)
    1220         self.assertRaises(pg.ProgrammingError, can, 'test', 'foobar')
    1221         self.assertRaises(pg.ProgrammingError, can, 'table_does_not_exist')
    12221224
    12231225    def testGet(self):
Note: See TracChangeset for help on using the changeset viewer.