def test_check_config_happy_path(aws: AWS, caplog: LogCaptureFixture) -> None: """ Given: A correctly configured AWS adapter object. When: Configuration is checked Then: The user is informed of the correct state. """ aws.check_configuration() # act assert ("drode.adapters.aws", logging.INFO, "AWS: OK") in caplog.record_tuples
def test_check_config_unauthorized_error( aws: AWS, boto: Mock, caplog: LogCaptureFixture ) -> None: """ Given: An incorrectly configured AWS adapter object. When: Configuration is checked. Then: The user is informed of the incorrect state and an exception is raised. """ boto.client.side_effect = NoRegionError() with pytest.raises(AWSConfigurationError): aws.check_configuration() assert ("drode.adapters.aws", logging.ERROR, "AWS: KO") in caplog.record_tuples