예제 #1
0
 def test_passes_along_the_default_probability(self):
     chaos.handler(None, mock.Mock())
     self.get_default_probability.assert_called_once_with()
     self.chaos_lambda.assert_called_once_with(
         mock.ANY,
         self.get_default_probability.return_value
     )
예제 #2
0
 def test_extracts_region_from_function_arn(self):
     context = mock.Mock()
     for region in ("eu-west-1", "sp-moonbase-1"):
         context.invoked_function_arn = "arn:aws:lambda:" + region + ":..."
         self.chaos_lambda.reset_mock()
         chaos.handler(None, context)
         self.chaos_lambda.assert_called_once_with(region)
예제 #3
0
 def test_extracts_region_from_function_arn(self):
     context = mock.Mock()
     for region in ("eu-west-1", "sp-moonbase-1"):
         context.invoked_function_arn = "arn:aws:lambda:" + region + ":..."
         self.chaos_lambda.reset_mock()
         chaos.handler(None, context)
         self.chaos_lambda.assert_called_once_with(region)
예제 #4
0
 def test_passes_along_the_region_list(self):
     context = mock.sentinel.context
     chaos.handler(None, context)
     self.get_regions.assert_called_once_with(context)
     self.chaos_lambda.assert_called_once_with(
         self.get_regions.return_value,
         mock.ANY
     )
예제 #5
0
 def test_passes_along_the_default_probability(self):
     chaos.handler(None, mock.Mock())
     self.get_default_probability.assert_called_once_with()
     self.chaos_lambda.assert_called_once_with(
         mock.ANY, self.get_default_probability.return_value)
예제 #6
0
 def test_passes_along_the_region_list(self):
     context = mock.sentinel.context
     chaos.handler(None, context)
     self.get_regions.assert_called_once_with(context)
     self.chaos_lambda.assert_called_once_with(
         self.get_regions.return_value, mock.ANY)
예제 #7
0
 def test_passes_along_the_default_probability(self):
     chaos.handler(None, mock.Mock())
     self.chaos_lambda.assert_called_once_with(mock.ANY,
                                               self.DEFAULT_PROBABILITY)
예제 #8
0
 def test_parseable_log_line_for_trigger(self):
     context = mock.Mock()
     context.invoked_function_arn = "arn:aws:lambda:sp-moonbase-1:..."
     chaos.handler(None, context)
     self.log.assert_called_once_with("triggered", "sp-moonbase-1")
예제 #9
0
 def test_parseable_log_line_for_trigger(self):
     context = mock.Mock()
     context.invoked_function_arn = "arn:aws:lambda:sp-moonbase-1:..."
     chaos.handler(None, context)
     self.log.assert_called_once_with("triggered", "sp-moonbase-1")