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
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
def run(client, description): res = client.query(**description) return response(res)
def run(client, description): res = client.create_table(**description) return response(res)
def run(client, description): res = client.update_item(**description) return response(res)
def test_response_returns_none_from_empty_items_list(): mock_response = {'items': []} assert response(mock_response).items() is None
def test_response_returns_none_from_no_results(): mock_response = {} assert response(mock_response).item() is None assert response(mock_response).items() is None