示例#1
0
 def test_uses_paginator_for_describe_auto_scaling_groups(self):
     autoscaling = mock.Mock()
     paginator = autoscaling.get_paginator.return_value
     paginator.paginate.return_value = iter([])
     asgs = chaos.get_all_asgs(autoscaling)
     list(asgs)  # force evaluation of the generator
     autoscaling.get_paginator.assert_called_once_with(
         "describe_auto_scaling_groups")
     paginator.paginate.assert_called_once_with()
示例#2
0
 def test_uses_paginator_for_describe_auto_scaling_groups(self):
     autoscaling = mock.Mock()
     paginator = autoscaling.get_paginator.return_value
     paginator.paginate.return_value = iter([])
     asgs = chaos.get_all_asgs(autoscaling)
     list(asgs)  # force evaluation of the generator
     autoscaling.get_paginator.assert_called_once_with(
         "describe_auto_scaling_groups"
     )
     paginator.paginate.assert_called_once_with()
示例#3
0
 def test_ignores_responses_with_missing_AutoScalingGroups_key(self):
     autoscaling = mock.Mock()
     paginator = autoscaling.get_paginator.return_value
     paginator.paginate.return_value = iter([{
         "AutoScalingGroups": [mock.sentinel.one]
     }, {}, {
         "AutoScalingGroups": [mock.sentinel.two]
     }])
     asgs = chaos.get_all_asgs(autoscaling)
     self.assertEqual(set(asgs), set([mock.sentinel.one,
                                      mock.sentinel.two]))
示例#4
0
 def test_ignores_responses_with_missing_AutoScalingGroups_key(self):
     autoscaling = mock.Mock()
     paginator = autoscaling.get_paginator.return_value
     paginator.paginate.return_value = iter([
         {"AutoScalingGroups": [mock.sentinel.one]},
         {},
         {"AutoScalingGroups": [mock.sentinel.two]}
     ])
     asgs = chaos.get_all_asgs(autoscaling)
     self.assertEqual(set(asgs), set([
         mock.sentinel.one,
         mock.sentinel.two
     ]))
示例#5
0
 def test_yields_asgs_from_each_response(self):
     autoscaling = mock.Mock()
     paginator = autoscaling.get_paginator.return_value
     paginator.paginate.return_value = iter([
         {"AutoScalingGroups": [mock.sentinel.one, mock.sentinel.two]},
         {"AutoScalingGroups": [mock.sentinel.three]},
         {"AutoScalingGroups": [mock.sentinel.four, mock.sentinel.five]}
     ])
     asgs = chaos.get_all_asgs(autoscaling)
     self.assertEqual(set(asgs), set([
         mock.sentinel.one,
         mock.sentinel.two,
         mock.sentinel.three,
         mock.sentinel.four,
         mock.sentinel.five
     ]))
示例#6
0
 def test_yields_asgs_from_each_response(self):
     autoscaling = mock.Mock()
     paginator = autoscaling.get_paginator.return_value
     paginator.paginate.return_value = iter([{
         "AutoScalingGroups": [mock.sentinel.one, mock.sentinel.two]
     }, {
         "AutoScalingGroups": [mock.sentinel.three]
     }, {
         "AutoScalingGroups": [mock.sentinel.four, mock.sentinel.five]
     }])
     asgs = chaos.get_all_asgs(autoscaling)
     self.assertEqual(
         set(asgs),
         set([
             mock.sentinel.one, mock.sentinel.two, mock.sentinel.three,
             mock.sentinel.four, mock.sentinel.five
         ]))