Exemplo n.º 1
0
def test_lambda_function_bad_error_propagates(stubbed_lambda):
    client, stub = stubbed_lambda
    query = ResourceQuery(client, None)
    stub.add_client_error('get_function',
                          service_error_code='SomeOtherBadException',
                          service_message='Internal Error',
                          http_status_code=500)
    stub.activate()

    with pytest.raises(botocore.exceptions.ClientError):
        query.lambda_function_exists(name='noexist')
    stub.assert_no_pending_responses()
Exemplo n.º 2
0
def test_lambda_function_bad_error_propagates(stubbed_lambda):
    client, stub = stubbed_lambda
    query = ResourceQuery(client, None)
    stub.add_client_error(
        'get_function',
        service_error_code='SomeOtherBadException',
        service_message='Internal Error',
        http_status_code=500
    )
    stub.activate()

    with pytest.raises(botocore.exceptions.ClientError):
        query.lambda_function_exists(name='noexist')
    stub.assert_no_pending_responses()
Exemplo n.º 3
0
def test_can_query_lambda_function_exists(stubbed_lambda):
    client, stub = stubbed_lambda
    query = ResourceQuery(client, None)
    stub.add_response('get_function',
                      service_response={'Code': {}, 'Configuration': {}},
                      expected_params={'FunctionName': 'myappname'})
    stub.activate()
    assert query.lambda_function_exists(name='myappname')
    stub.assert_no_pending_responses()
Exemplo n.º 4
0
def test_lambda_function_does_not_exist(stubbed_lambda):
    client, stub = stubbed_lambda
    query = ResourceQuery(client, None)
    stub.add_client_error('get_function',
                          service_error_code='ResourceNotFoundException',
                          service_message='ResourceNotFound')
    stub.activate()

    assert query.lambda_function_exists(name='noexist') == False
    stub.assert_no_pending_responses()
Exemplo n.º 5
0
def test_lambda_function_does_not_exist(stubbed_lambda):
    client, stub = stubbed_lambda
    query = ResourceQuery(client, None)
    stub.add_client_error(
        'get_function', service_error_code='ResourceNotFoundException',
        service_message='ResourceNotFound'
    )
    stub.activate()

    assert query.lambda_function_exists(name='noexist') == False
    stub.assert_no_pending_responses()
Exemplo n.º 6
0
def test_can_query_lambda_function_exists(stubbed_lambda):
    client, stub = stubbed_lambda
    query = ResourceQuery(client, None)
    stub.add_response('get_function',
                      service_response={
                          'Code': {},
                          'Configuration': {}
                      },
                      expected_params={'FunctionName': 'myappname'})
    stub.activate()
    assert query.lambda_function_exists(name='myappname')
    stub.assert_no_pending_responses()