예제 #1
0
def test_profiles_without_method():
    from cis import configurations

    response = configurations.profiles({'pathParameters': {}}, {})

    assert response['statusCode'] == http.HTTPStatus.BAD_REQUEST
    body = json.loads(response['body'])

    assert len(body) > 0
    assert body['error'] == 'missing or invalid method path parameter'
예제 #2
0
def test_profiles_without_id(compound_list):
    from cis import configurations

    response = configurations.profiles(
        {
            'pathParameters': {
                'method': compound_list[0]['method'],
                'version': compound_list[0]['version'],
                'object_type': 'target'
            }
        }, {})

    assert response['statusCode'] == http.HTTPStatus.BAD_REQUEST
    body = json.loads(response['body'])

    assert len(body) > 0
    assert 'missing splash' in body['error']
예제 #3
0
def test_sample_profiles(compound_list):
    from cis import configurations

    response = configurations.profiles(
        {
            'pathParameters': {
                'method': compound_list[0]['method'],
                'version': compound_list[0]['version'],
                'object_type': 'sample',
                'value': urllib.parse.quote(compound_list[0]['sample'])
            }
        }, {})

    assert response['statusCode'] == http.HTTPStatus.OK
    body = json.loads(response['body'])

    assert len(body) > 0
    assert len(body['profiles']) > 0
예제 #4
0
def test_profiles_with_wrong_type(compound_list):
    from cis import configurations

    response = configurations.profiles(
        {
            'pathParameters': {
                'method': compound_list[0]['method'],
                'version': compound_list[0]['version'],
                'object_type': 'bad_wrong'
            }
        }, {})

    assert response['statusCode'] == http.HTTPStatus.BAD_REQUEST
    body = json.loads(response['body'])

    assert len(body) > 0
    assert 'missing or invalid object type, it should be <target|sample>' in body[
        'error']