# -*- coding: utf-8 -*-importopenerp.tests.commonascommonfromopenerpimportexceptionsclassTestPosRequireCustomer(common.TransactionCase):defsetUp(self):super(TestPosRequireCustomer,self).setUp()deftest_customer_not_required(self):posconfig=self.env.ref('point_of_sale.pos_config_main')posconfig.require_customer='no'# Now Create new session and create a# pos order in this sessionpos_session=self.env['pos.session'].create({'config_id':posconfig.id})# should not raise any exceptionself.env['pos.order'].create({'session_id':pos_session.id,'partner_id':False,})deftest_customer_is_required(self):posconfig=self.env.ref('point_of_sale.pos_config_main')posconfig.require_customer='order'# Now Create new session and create a# pos order in this sessionpos_session=self.env['pos.session'].create({'config_id':posconfig.id})# should raise exceptions.ValidationErrorwithself.assertRaises(exceptions.ValidationError):self.env['pos.order'].create({'session_id':pos_session.id,'partner_id':False,})