def test_ami_id_cached_cleared(requests_mock): requests_mock.get(METADATA_URL + 'ami-id', text='ami-12345678') ec2_metadata.ami_id ec2_metadata.clear_all() requests_mock.get(METADATA_URL + 'ami-id', status_code=500) with pytest.raises(requests.exceptions.HTTPError): ec2_metadata.ami_id
def test_ami_id_cached_cleared(resps): add_response(resps, 'ami-id', 'ami-12345678') add_response(resps, 'ami-id', 'ami-12345678') ec2_metadata.ami_id ec2_metadata.clear_all() ec2_metadata.ami_id assert len(resps.calls) == 2
def clear_it(): ec2_metadata.clear_all()