How to use get_health_check_status method in localstack

Best Python code snippet using localstack_python

test_route53_probes.py

Source:test_route53_probes.py Github

copy

Full Screen

...35 with pytest.raises(FailedActivity) as e:36 get_hosted_zone(zone_id="BBBBBBBBBBBBB")37 assert "Hosted Zone BBBBBBBBBBBBB not found." in str(e)38@patch("chaosaws.route53.probes.aws_client", autospec=True)39def test_get_health_check_status(m_client):40 mock_response = read_in_data("get_health_check_status_1.json")41 client = MagicMock()42 m_client.return_value = client43 client.get_health_check_status.return_value = mock_response44 response = get_health_check_status(check_id="00000000-0000-0000-0000-000000000000")45 client.get_health_check_status.assert_called_with(46 HealthCheckId="00000000-0000-0000-0000-000000000000"47 )48 assert len(response["HealthCheckObservations"]) == 249@patch("chaosaws.route53.probes.aws_client", autospec=True)50def test_get_health_check_status_not_found(m_client):51 mock_response = ClientError(52 operation_name="get_hosted_zone",53 error_response={54 "Error": {"Message": "Test Error", "Code": "NoSuchHealthCheck"}55 },56 )57 client = MagicMock()58 m_client.return_value = client59 client.get_health_check_status.side_effect = mock_response60 with pytest.raises(FailedActivity) as e:61 get_health_check_status(check_id="00000000-1111-1111-1111-000000000000")62 assert "Test Error" in str(e)63@patch("chaosaws.route53.probes.aws_client", autospec=True)64def test_get_health_check_status_no_results(m_client):65 mock_response = {"HealthCheckObservations": []}66 client = MagicMock()67 m_client.return_value = client68 client.get_health_check_status.return_value = mock_response69 with pytest.raises(FailedActivity) as e:70 get_health_check_status(check_id="00000000-2222-2222-2222-000000000000")71 assert "No results found for" in str(e)72@patch("chaosaws.route53.probes.aws_client", autospec=True)73def test_get_dns_answer(m_client):74 mock_response = read_in_data("test_dns_answer_1.json")75 client = MagicMock()76 m_client.return_value = client77 client.test_dns_answer.return_value = mock_response78 response = get_dns_answer(79 zone_id="AAAAAAAAAAAAA", record_name="aws.testrecord.com", record_type="A"80 )81 client.test_dns_answer.assert_called_with(82 HostedZoneId="AAAAAAAAAAAAA", RecordName="aws.testrecord.com", RecordType="A"83 )84 assert response["ResponseCode"] == "NOERROR"...

Full Screen

Full Screen

probes.py

Source:probes.py Github

copy

Full Screen

...19 response = hosted_zone_by_id(client, zone_id)20 if not response["HostedZone"]:21 raise FailedActivity("Hosted Zone %s not found." % zone_id)22 return response23def get_health_check_status(24 check_id: str, configuration: Configuration = None, secrets: Secrets = None25) -> AWSResponse:26 """Get the status of the specified health check27 :param check_id: The health check id28 :param configuration: access values used by actions/probes29 :param secrets: values that need to be passed on to actions/probes30 :returns: Dict[str, Any]31 """32 client = aws_client("route53", configuration, secrets)33 try:34 response = client.get_health_check_status(HealthCheckId=check_id)35 if not response.get("HealthCheckObservations"):36 raise FailedActivity("No results found for %s" % check_id)37 return response38 except ClientError as e:39 logger.exception(e.response["Error"]["Message"])40 raise FailedActivity(e.response["Error"]["Message"])41def get_dns_answer(42 zone_id: str,43 record_name: str,44 record_type: str,45 configuration: Configuration = None,46 secrets: Secrets = None,47) -> AWSResponse:48 """Get the DNS response for the specified record name & type...

Full Screen

Full Screen

health_check.py

Source:health_check.py Github

copy

Full Screen

2from server.enums.status_enum import StatusEnum3from server.schemas.status_schema import StatusSchema4router = APIRouter()5@router.get("/health-check/", response_model=StatusSchema)6async def get_health_check_status():7 """Get health check status"""...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful