def test_cache_miss(self, mock_get): mock_get.return_value = {} with override_settings(SENTRY_RELEASE_REGISTRY_BASEURL="http://localhost:5000"): with self.assertRaisesRegex( IntegrationError, "Could not find cache value with key aws-layer:node", ): get_option_value(self.node_fn, OPTION_VERSION)
def test_invalid_region(self, mock_get): fn = { "Runtime": "nodejs10.x", "FunctionArn": "arn:aws:lambda:us-gov-east-1:599817902985:function:lambdaB", } mock_get.return_value = self.cache_value with override_settings(SENTRY_RELEASE_REGISTRY_BASEURL="http://localhost:5000"): with self.assertRaisesRegex(IntegrationError, "Unsupported region us-gov-east-1"): get_option_value(fn, OPTION_VERSION)
def test_with_cache(self, mock_get): mock_get.return_value = self.cache_value with override_settings( SENTRY_RELEASE_REGISTRY_BASEURL="http://localhost:5000"): assert get_option_value(self.node_fn, OPTION_VERSION) == "19" assert get_option_value( self.node_fn, OPTION_LAYER_NAME) == "SentryNodeServerlessSDK" assert get_option_value(self.node_fn, OPTION_ACCOUNT_NUMBER) == "943013980633"
def test_no_cache(self): assert get_option_value(self.node_fn, OPTION_VERSION) == "3" assert get_option_value(self.node_fn, OPTION_LAYER_NAME) == "my-layer" assert get_option_value(self.node_fn, OPTION_ACCOUNT_NUMBER) == "1234" assert get_option_value(self.python_fn, OPTION_VERSION) == "34" assert get_option_value(self.python_fn, OPTION_LAYER_NAME) == "my-python-layer" assert get_option_value(self.python_fn, OPTION_ACCOUNT_NUMBER) == "1234"