def setUp(self): super(QuantumFloatingHandlerTest, self).setUp() domain = self.create_domain() self.domain_id = domain['id'] self.config(domain_id=domain['id'], group='handler:quantum_floatingip') self.plugin = QuantumFloatingHandler()
class QuantumFloatingHandlerTest(NotificationHandlerTestCase): __test__ = True def setUp(self): super(QuantumFloatingHandlerTest, self).setUp() domain = self.create_domain() self.domain_id = domain['id'] self.config(domain_id=domain['id'], group='handler:quantum_floatingip') self.plugin = QuantumFloatingHandler() def test_floatingip_associate(self): event_type = 'floatingip.update.end' fixture = self.get_notification_fixture('quantum', event_type + '_associate') self.assertIn(event_type, self.plugin.get_event_types()) # Ensure we start with 0 records records = self.central_service.find_records(self.admin_context, self.domain_id) self.assertEqual(0, len(records)) self.plugin.process_notification(event_type, fixture['payload']) # Ensure we now have exactly 1 record records = self.central_service.find_records(self.admin_context, self.domain_id) self.assertEqual(len(records), 1) def test_floatingip_disassociate(self): start_event_type = 'floatingip.update.end' start_fixture = self.get_notification_fixture( 'quantum', start_event_type + '_associate') self.plugin.process_notification(start_event_type, start_fixture['payload']) event_type = 'floatingip.update.end' fixture = self.get_notification_fixture('quantum', event_type + '_disassociate') self.assertIn(event_type, self.plugin.get_event_types()) # Ensure we start with at least 1 record records = self.central_service.find_records(self.admin_context, self.domain_id) self.assertGreaterEqual(len(records), 1) self.plugin.process_notification(event_type, fixture['payload']) records = self.central_service.find_records(self.admin_context, self.domain_id) self.assertEqual(0, len(records))
class QuantumFloatingHandlerTest(NotificationHandlerTestCase): __test__ = True def setUp(self): super(QuantumFloatingHandlerTest, self).setUp() domain = self.create_domain() self.domain_id = domain['id'] self.config(domain_id=domain['id'], group='handler:quantum_floatingip') self.plugin = QuantumFloatingHandler() def test_floatingip_associate(self): event_type = 'floatingip.update.end' fixture = self.get_notification_fixture( 'quantum', event_type + '_associate') self.assertIn(event_type, self.plugin.get_event_types()) # Ensure we start with 0 records records = self.central_service.get_records(self.admin_context, self.domain_id) self.assertEqual(0, len(records)) self.plugin.process_notification(event_type, fixture['payload']) # Ensure we now have exactly 1 record records = self.central_service.get_records(self.admin_context, self.domain_id) self.assertEqual(len(records), 1) def test_floatingip_disassociate(self): start_event_type = 'floatingip.update.end' start_fixture = self.get_notification_fixture( 'quantum', start_event_type + '_associate') self.plugin.process_notification(start_event_type, start_fixture['payload']) event_type = 'floatingip.update.end' fixture = self.get_notification_fixture( 'quantum', event_type + '_disassociate') self.assertIn(event_type, self.plugin.get_event_types()) # Ensure we start with at least 1 record records = self.central_service.get_records(self.admin_context, self.domain_id) self.assertGreaterEqual(len(records), 1) self.plugin.process_notification(event_type, fixture['payload']) records = self.central_service.get_records(self.admin_context, self.domain_id) self.assertEqual(0, len(records))