def testInsert(self): sdao = SourceDAO() source = Source() source.name = 'zezinho' source.hash = self.hash source.software = 'mldonkey 3.1.2' source.osinfo = 'Linux' sid = sdao.insertOrUpdate(source) assert sid is not None, 'error inserting source'
def findByHash(self, hash): query = "SELECT * FROM %s WHERE hash = '%s'" % (self.tablename, hash) logging.debug(query) self.cursor.execute(query) rs = self.cursor.fetchall() if not rs: return None source = Source() for row in rs: source.id = row[0] source.name = row[1] source.hash = row[2] source.software = row[3] source.osinfo = row[4] return source