def test_verbose_one(self):
     args = ["--os-auth-url", "http://no.com", "-v", "server"]
     config = CloudCleanerConfig(args=args)
     ALL_RESOURCES["server"].register(config)
     config.parse_args()
     log = getLogger("cloud_cleaner")
     self.assertEqual(log.getEffectiveLevel(), INFO)
     shade = config.get_shade()
     self.assertIsInstance(shade, OpenStackCloud)
Exemple #2
0
 def __test_with_calls(self, args, calls):
     shade = Mock()
     shade.list_floating_ips = Mock(return_value=FLOATING_IPS)
     shade.delete_floating_ip = Mock()
     calls = [call(i) for i in calls]
     config = CloudCleanerConfig(args=args)
     config.get_shade = Mock(return_value=shade)
     fip = Fip()
     fip.register(config)
     config.parse_args()
     fip.process()
     fip.clean()
     self.assertEqual(shade.delete_floating_ip.call_args_list, calls)
Exemple #3
0
 def __test_with_call_order(self, args, calls):
     shade = Mock()
     shade.list_servers = Mock(return_value=SAMPLE_SERVERS)
     shade.delete_server = Mock()
     config = CloudCleanerConfig(args=args)
     config.get_shade = Mock(return_value=shade)
     calls = [call(c) for c in calls]
     server = Server(now=CURRENT_TIME)
     server.register(config)
     config.parse_args()
     server.process()
     server.clean()
     self.assertEqual(shade.delete_server.call_args_list, calls)