예제 #1
0
def test_get_project_uses_cached_info():
    """
        subsequent calls to getProjects returns the cached information
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    projects_initial = jp.getProjects()
    projects_subsequent = jp.getProjects()

    assert id(projects_initial) == id(projects_subsequent)
    assert PROJECT_KEY_1 in projects_subsequent
    assert projects_subsequent[PROJECT_KEY_1] == PROJECT_NAME_1
예제 #2
0
def test_basic_get_projects():
    """
        will return a hash of project keys as keys and project names 
        as values with the getProjects method
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    projects = jp.getProjects()
    assert PROJECT_KEY_1 in projects
    assert projects[PROJECT_KEY_1] == PROJECT_NAME_1
예제 #3
0
def main(args):

    jira = JiraProxy(REG_USER_CONFIG)

    if not jira:
        print(
            "Unable to obtain a JiraProxy instance for the given configuration"
        )
        sys.exit(1)

    try:
        jira_projects = jira.getProjects()
    except Exception as exc:
        problem = exc.args[0]
        print(
            f'Error while attempting to retrieve Jira project names: {problem}'
        )
        sys.exit(2)

    for key in jira_projects:
        print(key)
    print("\n")

    try:
        jira_project_details = jira.getProjectsDetails()
    except Exception as exc:
        problem = exc.args[0]
        print(
            f'Error while attempting to retrieve Jira project details: {problem}'
        )
        sys.exit(3)

    print(f'{"Key":<12}  :  {"Name":<30}  :  {"ID":<6}')
    print("-" * 60)

    for project in jira_project_details:
        key, name, details = [
            project[attr] for attr in ['Key', 'Name', 'Details']
        ]
        print(f'{key:<12}  :  {name:<30}  : {details["id"]:>6}')
    print("\n")
def main(args):
    config = REG_USER_CONFIG
    config['logger'] = BasicLogger('11_gp.log')

    jira = JiraProxy(config)

    jira_proj = jira.getProjects()

    print(f'{"Key":<12}  {"Name":<24}')
    print("-" * 40)

    for key, name in jira_proj.items():
        print(f'{key:<12}  {name:}')

    print("\n\n")

    jira_project_details = jira.getProjectsDetails()

    print(f'{"Key":<12}  {"Name":<24}  {"ID":<6}')
    print("-" * 60)
    for project in jira_project_details:
        print(
            f'{project["Key"]:<12}  {project["Name"]:<24}  {project["Details"]["id"]:<6}'
        )