def getworkitemtitle(wrkitemid):
    # HTTP Basic Auth with personal access token
    client = TFSAPI("TFS URL HERE", project="TFS PROJECT", pat='patid')
    # For single Workitem
    workitem = client.get_workitem(int(wrkitemid))

    # Get all fields
    # Case insensitive. Remove space in field name
    return workitem['Title']
def getacptnccriteria(wrkitemid):
    # HTTP Basic Auth with personal access token
    client = TFSAPI("TFS URL HERE", project="TFS PROJECT", pat='patid')
    # For single Workitem

    workitem = client.get_workitem(int(wrkitemid))
    actnccrit = html2text.html2text(
        workitem['Microsoft.VSTS.Common.AcceptanceCriteria'])
    # Get all fields
    # Case insensitive. Remove space in field name
    return actnccrit
Example #3
0
def validate_setting(token, query):
    """Validates token and query"""

    if len(token) < 52:
        return False

    if not re.compile(
            "^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}"
    ).match(query):
        return False

    with open('config.json') as config_file:
        configs = json.load(config_file)
    client = TFSAPI(configs['server'], project=configs['project'], pat=token)
    try:
        client.run_query(query)
    except:
        error_dialog.showMessage('Check your token or query.')
        return False

    return True
Example #4
0
    return True


if __name__ == '__main__':
    start_flag = False
    stop_flag = False
    config_token = ''
    config_query = ''
    app = QtWidgets.QApplication([])
    app.setQuitOnLastWindowClosed(False)
    window = WorkingOnWindow()
    window.show()
    error_dialog = QtWidgets.QErrorMessage()
    if validation():
        with open('config.json') as config_file:
            configs = json.load(config_file)
            config_token = configs['token']
            config_query = configs['query']
            client = TFSAPI(configs['server'],
                            project=configs['project'],
                            pat=config_token)
            flag = json.load(open(configs['data_file']))['flag'] == 1
            start_flag = not bool(flag)
            stop_flag = bool(flag)
            window.btStart.setEnabled(start_flag)
            window.btStop.setEnabled(stop_flag)
            window.init_setting()
            window.refresh_query()
    app.exec_()