コード例 #1
0
def test_configs_without_method():
    from cis import configurations

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

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

    assert len(body) > 0
    assert 'missing or invalid method' in body['error']
コード例 #2
0
def test_target_configs_without_splash(compound_list):
    from cis import configurations

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

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

    assert len(body) > 0
    assert body['error'] == 'missing splash as value path parameter'
コード例 #3
0
def test_sample_config(compound_list):
    from cis import configurations

    response = configurations.configs(
        {
            'pathParameters': {
                'method': urllib.parse.quote(compound_list[0]['method']),
                'version': urllib.parse.quote(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['configs']) > 0
コード例 #4
0
def test_configs_with_wrong_type(compound_list):
    from cis import configurations

    response = configurations.configs(
        {
            'pathParameters': {
                'method': urllib.parse.quote(compound_list[0]['method']),
                'version': urllib.parse.quote(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']