def test_router_status_same(self):
     self.test_instance_manager.router_obj = mock.Mock(id='ABC123')
     self.test_instance_manager._last_synced_status = neutron.STATUS_ACTIVE
     self.test_instance_manager.state = instance_manager.CONFIGURED
     v = instance_manager.synchronize_router_status(
         lambda instance_manager_inst, ctx, silent: 1)
     self.assertEqual(v(self.test_instance_manager, self.test_context), 1)
     self.assertEqual(
         self.test_context.neutron.update_router_status.call_count, 0)
     self.assertEqual(self.test_instance_manager._last_synced_status,
                      neutron.STATUS_ACTIVE)
 def test_router_status_changed(self):
     self.test_instance_manager.router_obj = mock.Mock(id='ABC123')
     self.test_instance_manager._last_synced_status = neutron.STATUS_ACTIVE
     self.test_instance_manager.state = instance_manager.DOWN
     v = instance_manager.synchronize_router_status(
         lambda instance_manager_inst, ctx, silent: 1)
     self.assertEqual(v(self.test_instance_manager, self.test_context), 1)
     self.test_context.neutron.update_router_status.\
         assert_called_once_with(
             'ABC123',
             neutron.STATUS_DOWN)
     self.assertEqual(self.test_instance_manager._last_synced_status,
                      neutron.STATUS_DOWN)
 def test_router_is_deleted(self):
     self.test_instance_manager.router_obj = None
     v = instance_manager.synchronize_router_status(
         lambda instance_manager_inst, ctx, silent: 1)
     self.assertEqual(v(self.test_instance_manager, {}), 1)