def test_after_import_gets_ref_for_cp_state(self):
        """ It should get reference for carepoint state record """
        with mock.patch.multiple(
            self.unit, binder_for=mock.DEFAULT, unit_for=mock.DEFAULT,
            session=mock.DEFAULT, _get_binding=mock.DEFAULT,
        ):
            invoice_id = self.unit._get_binding().invoice_id
            self.unit.unit_for()._get_order_line_count.return_value = 1
            invoice_id.invoice_line_ids = [True]
            self.unit.env.ref.side_effect = EndTestException
            with self.assertRaises(EndTestException):
                self.unit._after_import(self.record)
            self.unit.env.ref.assert_called_with(
                'connector_carepoint.state_%d' % (
                    self.unit.binder_for().to_odoo().sale_line_id.
                    order_id.carepoint_order_state_cn
                )
            )