test-platform/server/cgi/test_list.py

20 lines
557 B
Python

import mariadb as mdb
from db.test import TestPool
class TestList:
def __init__(self, cursor):
self.cursor = cursor
def render(self, *args):
tp = TestPool(self.cursor)
if len(args) > 0:
rendered_chunks = [i.render_short() for i in tp.object_pool.pool if args[0] in i.get_name()]
else:
rendered_chunks = [i.render_short() for i in tp.object_pool.pool]
return "\n".join(rendered_chunks)
def count(self):
tp = TestPool(self.cursor)
return len(tp.object_pool.pool)