e2e: align with testrail API

This commit is contained in:
Churikova Tetiana 2021-09-20 12:08:04 +02:00
parent 5b72e749e3
commit ca273faadd
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
1 changed files with 6 additions and 5 deletions

View File

@ -28,6 +28,7 @@ class TestrailReport(BaseTestReport):
self.headers['Authorization'] = 'Basic %s' % str( self.headers['Authorization'] = 'Basic %s' % str(
base64.b64encode(bytes('%s:%s' % (self.user, self.password), 'utf-8')), 'ascii').strip() base64.b64encode(bytes('%s:%s' % (self.user, self.password), 'utf-8')), 'ascii').strip()
self.headers['Content-Type'] = 'application/json' self.headers['Content-Type'] = 'application/json'
self.headers['x-api-ident'] = 'beta'
self.url = 'https://ethstatus.testrail.net/index.php?/' self.url = 'https://ethstatus.testrail.net/index.php?/'
self.api_url = self.url + 'api/v2/' self.api_url = self.url + 'api/v2/'
@ -46,13 +47,13 @@ class TestrailReport(BaseTestReport):
return self.get('get_suites/%s' % self.project_id) return self.get('get_suites/%s' % self.project_id)
def get_tests(self): def get_tests(self):
return self.get('get_tests/%s' % self.run_id) return self.get('get_tests/%s' % self.run_id)['tests']
def get_milestones(self): def get_milestones(self):
return self.get('get_milestones/%s' % self.project_id) return self.get('get_milestones/%s' % self.project_id)['milestones']
def get_runs(self, pr_number): def get_runs(self, pr_number):
return [i for i in self.get('get_runs/%s' % self.project_id) if 'PR-%s ' % pr_number in i['name']] return [i for i in self.get('get_runs/%s' % self.project_id)['runs'] if 'PR-%s ' % pr_number in i['name']]
def get_run(self, run_id: int): def get_run(self, run_id: int):
return self.get('get_run/%s' % run_id) return self.get('get_run/%s' % run_id)
@ -77,7 +78,7 @@ class TestrailReport(BaseTestReport):
def get_cases(self, section_ids): def get_cases(self, section_ids):
test_cases = list() test_cases = list()
for section_id in section_ids: for section_id in section_ids:
test_cases.append(self.get('get_cases/%s&suite_id=%s&section_id=%s' % (self.project_id, self.suite_id, section_id))) test_cases.append(self.get('get_cases/%s&suite_id=%s&section_id=%s' % (self.project_id, self.suite_id, section_id))['cases'])
return itertools.chain.from_iterable(test_cases) return itertools.chain.from_iterable(test_cases)
def get_regression_cases(self): def get_regression_cases(self):