Exemplo n.º 1
0
def test_pets_get_invalid_id():
    assert handler(
        {
            'path': '/pets/abc',
            'pathParameters': {},
            'resource': '',
            'requestContext': request_context_mock.dict(),
            'httpMethod': 'GET',
            'isBase64Encoded': False,
        },
        None,
    ) == {
        'body': '',
        'headers': {},
        'isBase64Encoded': False,
        'multiValueHeaders': {},
        'statusCode': 400,
    }
Exemplo n.º 2
0
def test_pets_get():
    assert handler(
        {
            'path': '/pets/1',
            'pathParameters': {},
            'resource': '',
            'requestContext': request_context_mock.dict(),
            'httpMethod': 'GET',
            'isBase64Encoded': False,
        },
        None,
    ) == {
        'body': '{"name": "dog", "age": 3, "pet_id": 1}',
        'headers': {},
        'isBase64Encoded': False,
        'multiValueHeaders': {},
        'statusCode': 200,
    }
Exemplo n.º 3
0
def test_pets_post_invalid_body():
    assert handler(
        {
            'path': '/pets',
            'pathParameters': {},
            'resource': '',
            'requestContext': request_context_mock.dict(),
            'httpMethod': 'POST',
            'body': '{"name": "snake"}',
            'isBase64Encoded': False,
        },
        None,
    ) == {
        'body': '',
        'headers': {},
        'isBase64Encoded': False,
        'multiValueHeaders': {},
        'statusCode': 400,
    }