コード例 #1
0
def test_cascade_delete_api_by_id(mock_crud, context_field):
    print('\n=> Testing cascade deleting api by id')
    api_id = context_field.get('api_id')
    endpoint_id = context_field.get('endpoint_id')
    field_id = context_field.get('field_id')

    code = CRUD.deleteApi(api_id)
    assert code>0
    existing_endpoint_id = CRUD.getEndpoint(endpoint_id)
    assert existing_endpoint_id is None
    existing_field = CRUD.getField(field_id)
    assert existing_field is None
コード例 #2
0
def test_edit_endpoint_by_id(mock_crud, context_endpoint):
    print('\n=> Testing editing endpoint by id')
    endpoint_id = context_endpoint.get('endpoint_id')
    label = generate_random_string()
    url = generate_random_string()
    description = ' '.join([generate_random_string() for _ in range(5)])
    tags = ' '.join([generate_random_string() for _ in range(5)])
    code = CRUD.editEndpoint(
        endpoint_id,
        label=label,
        url=url,
        description=description,
        tags=tags
    )
    assert code>0
    endpoint = CRUD.getEndpoint(endpoint_id)
    assert endpoint.label == label
    assert endpoint.url == url
    assert endpoint.description == description
    assert set(tags.split()) == set([t.text for t in endpoint.tags])
コード例 #3
0
 def get_endpoint(id):
     endpoint = CRUD.getEndpoint(id)
     j = endpoint_schema.dump(endpoint)
     return j