Esempio n. 1
0
 def setUp(self): 
     testlog.debug('Instantiate null address, address.setter list')
     #self.QI = QgisInterface(_Dummy_Canvas())
     qi = ASM.getMock(ASM.ASMenum.QI)()
     controller = Controller(qi)
     self._layermanager = LayerManager(qi,controller)
     self._layermanager.addressLayerAdded = ASM.getMock(ASM.ASMenum.SIGNAL)()
     Database.setup(DCONF)
 def test20_execute(self):
     '''checks database execution by testing whether a cursor is returned, which happens on commit'''
     testlog.debug('Test_2.20 Test query execution (SELECT) function')
     self.res = Database.execute(self.q1)
     from psycopg2._psycopg import cursor as PPC
     self.assertEquals(
         isinstance(self.res, PPC), True,
         'Query "{}" failed with {}'.format(self.q1, self.res))
Esempio n. 3
0
 def tearDown(self):
     testlog.debug('Destroy null layermanager')
     self._layermanager = None
     Database.setup({name:None for name in DCONF})                 
 def test10_instSetters(self):
     '''Tests that all the setters set a matching attribute i.e. setAttribute("X") -> self._Attribute = "X"'''
     testlog.debug('Test_1.10 Instantiate basic setters')
     Database.setHost(DCONF['host'])
     self.assertEquals(Database.host(),DCONF['host'],'Host not set')        
     Database.setPort(DCONF['port'])
     self.assertEquals(Database.port(),DCONF['port'],'Port not set')        
     Database.setUser(DCONF['user'])
     self.assertEquals(Database.user(),DCONF['user'],'User not set')        
     Database.setPassword(DCONF['password'])
     self.assertEquals(Database.password(),DCONF['password'],'Pwd not set')
     Database.setDatabase(DCONF['name'])
     self.assertEquals(Database.database(),DCONF['name'],'DB not set')
     Database.setAimsSchema(DCONF['aimsschema'])
     self.assertEquals(Database.aimsSchema(),DCONF['aimsschema'],'Schema not set')          
 def test20_execute(self):
     '''checks database execution by testing whether a cursor is returned, which happens on commit'''
     testlog.debug('Test_2.20 Test query execution (SELECT) function')
     self.res = Database.execute(self.q1)
     from psycopg2._psycopg import cursor as PPC
     self.assertEquals(isinstance(self.res,PPC),True,'Query "{}" failed with {}'.format(self.q1,self.res))
 def test10_connection(self):
     testlog.debug('Test_2.10 Test connection() function')
     self.conn = Database.connection()
     self.assertNotEqual(self.conn,None,'Connection not established')
 def setUp(self): 
     Database.setup(DCONF)
 def test10_instSetters(self):
     '''Tests that all the setters set a matching attribute i.e. setAttribute("X") -> self._Attribute = "X"'''
     testlog.debug('Test_1.10 Instantiate basic setters')
     Database.setHost(DCONF['host'])
     self.assertEquals(Database.host(), DCONF['host'], 'Host not set')
     Database.setPort(DCONF['port'])
     self.assertEquals(Database.port(), DCONF['port'], 'Port not set')
     Database.setUser(DCONF['user'])
     self.assertEquals(Database.user(), DCONF['user'], 'User not set')
     Database.setPassword(DCONF['password'])
     self.assertEquals(Database.password(), DCONF['password'],
                       'Pwd not set')
     Database.setDatabase(DCONF['name'])
     self.assertEquals(Database.database(), DCONF['name'], 'DB not set')
     Database.setAimsSchema(DCONF['aimsschema'])
     self.assertEquals(Database.aimsSchema(), DCONF['aimsschema'],
                       'Schema not set')
 def test10_connection(self):
     testlog.debug('Test_2.10 Test connection() function')
     self.conn = Database.connection()
     self.assertNotEqual(self.conn, None, 'Connection not established')
 def setUp(self):
     Database.setup(DCONF)