def hide__test_obtain_jira_issue_types_through_proxy(): """ Through a proxy, will return issue types with issue_types and issue_type_map """ # first deal with the 'InsecureRequestWarning: Unverified HTTPS request ....' issue whilst testing import warnings warnings.filterwarnings('ignore', message='Unverified HTTPS request') jp = JiraProxy(GOOD_ONDEMAND_VIA_GOOD_PROXY_CONFIG) issue_types, issue_type_map = jp.getIssueTypes() assert "Bug" in issue_types assert "Story" in issue_types # Specifying an invalid proxy host, will raise an exception import requests with py.test.raises(requests.exceptions.ProxyError) as excinfo: jp = JiraProxy(SUSPECT_ONDEMAND_VIA_NONEXISTENT_PROXY_CONFIG) actualErrorMessage = excErrorMessage(excinfo) assert "Failed to establish a new connection" in actualErrorMessage assert "nodename nor servname provided, or not known" in actualErrorMessage # Through a invalid proxy user, will raise an exception with py.test.raises(JiraProxyError) as excinfo: jp = JiraProxy(SUSPECT_ONDEMAND_VIA_BAD_PROXY_CONFIG) actualErrorMessage = excErrorMessage(excinfo) print('-----') print(actualErrorMessage)
def test_get_issue_type_info(): """ will return issue types with issue_types and issue_type_map """ jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG) issue_types, issue_type_map = jp.getIssueTypes() assert "Bug" in issue_types assert "Story" in issue_types assert 'Story' in issue_types and 'Story' in issue_type_map assert 'Bug' in issue_types and 'Bug' in issue_type_map assert int(issue_type_map['Story']['id']) > 10000 assert int(issue_type_map['Story']['id']) < 10010 assert int(issue_type_map['Bug']['id']) > 10000 assert int(issue_type_map['Bug']['id']) < 10010 assert int(issue_type_map['Story']['id']) != int( issue_type_map['Bug']['id'])