Imlement result searching based on type tests and by test run id
Related-prod: PRODX-29347, PRODX-30060
Change-Id: I2eaa6f1e5600b7b343056f68836f8e0c8c7e64e6
diff --git a/testrail_bot/control/views.py b/testrail_bot/control/views.py
index 67a368d..9077a7c 100644
--- a/testrail_bot/control/views.py
+++ b/testrail_bot/control/views.py
@@ -1,6 +1,7 @@
import datetime
import json
import os
+from .celery_tasks import test_rail_api
from django.shortcuts import render, redirect, HttpResponse
@@ -62,8 +63,11 @@
def submit_run(request, run_id):
run = models.TestRailTestRun.objects.get(pk=run_id)
- report_name = "{}-{}".format(
- run.run_name, datetime.datetime.isoformat(datetime.datetime.now()))
+ testrail_run = test_rail_api.get_run_by_id(run.run_id)
+ if not run.run_name:
+ run.run_name = testrail_run['name']
+ report_name = "{}-run_id-{}-date-{}".format(
+ run.run_name, run.run_id, datetime.datetime.isoformat(datetime.datetime.now()))
path = os.path.join(models.fs.location, report_name)
with open(path, "w"):
pass