示例#1
0
def test_job_list(runner, dci_context, team_id, topic_id,
                  remoteci_id, component_id):
    kwargs = {'name': 'tname', 'topic_id': topic_id,
              'component_types': ['git_review']}
    jd = jobdefinition.create(dci_context, **kwargs).json()
    jobdefinition_id = jd['jobdefinition']['id']

    kwargs = {'name': 'test_jobdefinition', 'team_id': team_id}
    test_id = test.create(dci_context, **kwargs).json()['test']['id']
    jobdefinition.add_test(dci_context, jobdefinition_id, test_id)
    kwargs = {'name': 'test_remoteci', 'team_id': team_id}
    test_id = test.create(dci_context, **kwargs).json()['test']['id']
    remoteci.add_test(dci_context, remoteci_id, test_id)

    job_id = job.schedule(
        dci_context, remoteci_id, topic_id).json()['job']['id']
    result = runner.invoke(['job-list-test', job_id])
    assert len(result['tests']) == 2
    assert result['tests'][0]['name'] == 'test_jobdefinition'
    assert result['tests'][1]['name'] == 'test_remoteci'
示例#2
0
def attach_test(context, id, test_id):
    """attach_test(context, id, test_id)

    Attach a test to a remoteci.

    >>> dcictl remoteci-attach-test [OPTIONS]

    :param string id: ID of the remoteci to attach the test to [required]
    :param string test_id: ID of the test to attach [required]
    """
    result = remoteci.add_test(context, id=id,
                               test_id=test_id)
    utils.format_output(result, context.format,
                        None, ['remoteci_id', 'test_id'])
示例#3
0
def attach_test(context, args):
    return remoteci.add_test(context, id=args.id, test_id=args.test_id)