fuel-qa/fuelweb_test/testrail/launchpad_client.py
Dennis Dmitriev 71b3307a7a Count the amount of unique bugs on swarm that are linked to TestRail
- Show the amount of unique bugs in TestRail report,
- Change version in settings from 6.1 to 7.0

Change-Id: I574d756e856c3d7fba109ac6bf3ff92cd64ecd86
Closes-Bug:#1474058
2015-07-14 23:10:43 +03:00

46 lines
1.7 KiB
Python

# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from launchpadlib.launchpad import Launchpad
class LaunchpadBug(object):
"""LaunchpadBug.""" # TODO documentation
def __init__(self, bug_id):
self.launchpad = Launchpad.login_anonymously('just testing',
'production',
'.cache')
self.bug = self.launchpad.bugs[int(bug_id)]
@property
def targets(self):
return [{'project': str(task.bug_target_name).split('/')[0],
'milestone': str(task.milestone).split('/')[-1],
'status': str(task.status),
'importance': str(task.importance),
'title': str(task.title),
} for task in self.bug_tasks]
def get_duplicate_of(self):
bug = self.bug
duplicates = []
while bug.duplicate_of and bug.id not in duplicates:
duplicates.append(bug.id)
bug = self.launchpad.load(str(bug.duplicate_of))
return LaunchpadBug(bug.id)
def __getattr__(self, item):
return self.bug.__getattr__(item)