示例#1
0
def get_full_data(context, id):
    # Get the job with embed on test and remoteci
    embed = 'jobdefinition,jobdefinition.test,remoteci'
    job = base.get(context, RESOURCE, id=id, embed=embed).json()['job']
    # Get the components of the jobdefinition
    jobdefinition_components = jobdefinition.get_components(
        context, job['jobdefinition']['id']).json()['components']

    # Aggregate the data of each resource
    full_data = {'remoteci': job['remoteci']['data'],
                 'test': job['jobdefinition']['test']['data'],
                 'components': []}

    for component in jobdefinition_components:
        full_data['components'].append(component['data'])

    return full_data
示例#2
0
def test_create_jobdefinition_and_add_component(runner, dci_context,
                                                components, test_id, topic_id):
    create_jobdefinition_and_add_component(dci_context, components, test_id,
                                           topic_id, jobdef_name='Test suite')

    team_id = team.list(dci_context).json()['teams'][0]['id']
    topic.attach_team(dci_context, topic_id, team_id)
    jdefs = jobdefinition.list(dci_context, topic_id).json()['jobdefinitions']
    jdef_names = [jdef['name'] for jdef in jdefs]

    jd_id = [jdef['id'] for jdef in jdefs if jdef['name'] == 'Test suite'][0]

    assert 'Test suite' in jdef_names

    jdef_cmpt = jobdefinition.get_components(dci_context, jd_id).json()
    jdef_cmpt = jdef_cmpt['components']

    assert 'component1' == jdef_cmpt[0]['name']
    assert 'component2' == jdef_cmpt[1]['name']