Get default case priority from project config

Remove hardcoded default test case priority and
use TestRail API client to get ID of current
default priority.

Change-Id: I9921e01734405acaad39e8e2a20360f7c047d652
Closes-bug: #1511317
This commit is contained in:
Artem Panchenko 2015-10-29 17:40:56 +02:00
parent 33d0ce8673
commit 7ddca0a827
2 changed files with 13 additions and 3 deletions

View File

@ -81,6 +81,10 @@ class TestRailProject():
if config['name'] == name:
return config
def get_priorities(self):
priorities_uri = 'get_priorities'
return self.client.send_get(uri=priorities_uri)
def get_milestones(self):
milestones_uri = 'get_milestones/{project_id}'.format(
project_id=self.project['id'])

View File

@ -26,7 +26,8 @@ from settings import TestRailSettings
from testrail_client import TestRailProject
def get_tests_descriptions(milestone_id, tests_include, tests_exclude, groups):
def get_tests_descriptions(milestone_id, tests_include, tests_exclude, groups,
default_test_priority):
import_tests()
tests = []
@ -73,7 +74,7 @@ def get_tests_descriptions(milestone_id, tests_include, tests_exclude, groups):
"title": title,
"type_id": 1,
"milestone_id": milestone_id,
"priority_id": 5,
"priority_id": default_test_priority,
"estimate": test_duration.group(1) if test_duration else "3m",
"refs": "",
"custom_test_group": test_group,
@ -189,6 +190,10 @@ def main():
testrail_milestone = project.get_milestone_by_name(
name=TestRailSettings.milestone)
testrail_default_test_priority = [priority['id'] for priority in
project.get_priorities() if
priority['is_default'] is True][0]
distros = [config['name'].split()[0].lower()
for config in project.get_config_by_name(
'Operation System')['configs']
@ -209,7 +214,8 @@ def main():
milestone_id=testrail_milestone['id'],
tests_include=TestRailSettings.tests_include,
tests_exclude=TestRailSettings.tests_exclude,
groups=tests_groups
groups=tests_groups,
default_test_priority=testrail_default_test_priority
)
upload_tests_descriptions(testrail_project=project,