Пример #1
0
def get_bugzilla_bug(bug_id):
    """Get Bugzilla bug details."""
    if len(validate_section('Bugzilla')) > 0:
        return None

    bugzilla_api_key = get_config_property('Bugzilla', 'api_key')
    base_url = get_config_property('Bugzilla', 'bugzilla_url')

    try:
        b = bugzilla.Bugzilla(url=base_url, api_key=bugzilla_api_key)
        return b.get_bug(bug_id)
    except Exception:
        return None
Пример #2
0
class TestSuiteMap:
    suite_dictionary = ast.literal_eval(
        get_config_property("Test_rail", "suite_dictionary"))

    suite_name = ''

    def __init__(self, suite_id, test_results_list):
        """

        :param suite_id: TestRail suite id
        :param test_results_list: a list of TestRailTests objects

        """
        self.suite_id = suite_id
        self.test_results_list = test_results_list
        self.get_suite_name()

    def get_suite_name(self):
        """
        Method that will parse config.ini and retrieve the suite name from
        suite_dictionary

        """
        for key in self.suite_dictionary:
            if self.suite_id == self.suite_dictionary.get(key):
                self.suite_name = key
Пример #3
0
 def __init__(self):
     logger.info('Starting email reporting.')
     self.email_host = get_config_property('Email', 'smtp_ssl_host')
     self.email_port = get_config_property('Email', 'smtp_ssl_port')
     self.username = get_config_property('Email', 'username')
     self.password = get_config_property('Email', 'password')
     self.sender = get_config_property('Email', 'sender')
     self.targets = ast.literal_eval(get_config_property('Email', 'targets'))
Пример #4
0
def get_github_issue(bug_id):
    """Get Github issues details."""
    if len(validate_section('GitHub')) > 0:
        return None

    github_api_key = Github(get_config_property('GitHub', 'github_key'))

    try:
        repo = [
            x for x in github_api_key.get_user().get_repos()
            if x.name == 'iris2'
        ]
        return repo[0].get_issue(bug_id)
    except Exception:
        return None
Пример #5
0
    def generate_test_suite_collection_objects(test_rail_tests: list):
        """
        :param test_rail_tests: a list of TestRailTest
        :return: a list of TestSuiteMap
        """
        test_suite_array = []
        suite_dictionary = ast.literal_eval(get_config_property('Test_Rail', 'suite_dictionary'))
        suite_ids = []
        for suite in suite_dictionary:
            suite_ids.append(suite_dictionary.get(suite))
        for suite_id in suite_ids:
            test_case_ids = []
            for test_result in test_rail_tests:
                if isinstance(test_result, TestRailTests):
                    if suite_id == test_result.section_id:
                        test_case_ids.append(test_result)
            if not test_case_ids:
                continue
            else:
                test_suite_object = TestSuiteMap(suite_id, test_case_ids)
                test_suite_array.append(test_suite_object)

        return test_suite_array
Пример #6
0
def get_update_rules():
    """Returns the 'update_rules' config property from the 'Update' section."""
    rules = get_config_property('Update', 'update_rules')
    if rules is None:
        return None
    return ast.literal_eval(rules)
Пример #7
0
 def __init__(self):
     logger.info('Starting TestRail reporting.')
     self.test_rail_url = get_config_property('Test_rail', 'test_rail_url')
     self.client = api_client.APIClient(self.test_rail_url)
     self.client.user = get_config_property('Test_rail', 'username')
     self.client.password = get_config_property('Test_rail', 'password')