def test_get_service_calls(lob: lobotomy.Lobotomy): """Should correctly retrieve service calls made.""" lob.data = { "clients": { "sts": { "get_caller_identity": { "Account": "123" } } } } session = lob() client = session.client("sts") assert client.get_caller_identity()["Account"] == "123" assert client.get_caller_identity( )["Account"] == "123", "Expected to work twice." assert len(lob.service_calls) == 2 assert len(lob.get_service_calls("sts", "get_caller_identity")) == 2 assert lob.get_service_call("sts", "get_caller_identity", 0) assert lob.get_service_call("sts", "get_caller_identity", 1) with pytest.raises(IndexError): lob.get_service_call("sts", "get_caller_identity", 2)
def test_sqs_delete_message(lobotomized: lobotomy.Lobotomy): """ Should handle sqs.delete_message without error despite edge case configuration in botocore service method definitions where the return structure has no members. """ lobotomized.add_call("sqs", "delete_message") lobotomized().client("sqs").delete_message( QueueUrl="https://sqs.us-west-2.amazonaws.com/123/my-queue", ReceiptHandle="fake-receipt-handle", ) assert lobotomized.get_service_call("sqs", "delete_message") is not None