diff options
Diffstat (limited to 'wsgi_server.py')
-rw-r--r-- | wsgi_server.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/wsgi_server.py b/wsgi_server.py index 76489db..1624772 100644 --- a/wsgi_server.py +++ b/wsgi_server.py @@ -147,6 +147,19 @@ class Query(CodeqService): session.update_solution(problem_id, trace, program) return result +class Test(CodeqService): + def process(self, js, session): + problem_id = js.get('problem_id') + program = js.get('program') + if problem_id is None: + return {'code': 1, 'message': 'Problem ID not given'} + if program is None: + return {'code': 2, 'message': 'No program specified'} + + prolog = session.get_prolog() + messages = prolog.test(session.get_uid(), problem_id, program) + return {'code': 0, 'message': 'ok', 'terminal': {'messages': messages}} + class GetProblem(CodeqService): def process(self, js, session): language = js.get('language') @@ -173,6 +186,9 @@ api.add_route('/activity', activity) query = Query() api.add_route('/query', query) +test = Test() +api.add_route('/test', test) + get_problem = GetProblem() api.add_route('/get_problem', get_problem) |