Example #1
0
def test_response_uses_destructure():
    mock_boto_response = {
        'Item': {
            "features": {
                "L": [{
                    "S": "glow"
                }, {
                    "S": "dust"
                }]
            }
        }
    }

    item = response(mock_boto_response).item()

    assert len(item.get('features')) == 2
Example #2
0
def test_response_destructure_items():
    mock_boto_response = {
        'Items': [{
            "features": {
                "L": [{
                    "S": "glow"
                }, {
                    "S": "dust"
                }]
            }
        }]
    }

    items = response(mock_boto_response).items()

    assert len(items[0].get('features')) == 2
Example #3
0
def run(client, description):
    res = client.query(**description)
    return response(res)
Example #4
0
def run(client, description):
    res = client.create_table(**description)
    return response(res)
Example #5
0
def run(client, description):
    res = client.update_item(**description)
    return response(res)
Example #6
0
def test_response_returns_none_from_empty_items_list():

    mock_response = {'items': []}

    assert response(mock_response).items() is None
Example #7
0
def test_response_returns_none_from_no_results():

    mock_response = {}

    assert response(mock_response).item() is None
    assert response(mock_response).items() is None