def test_customer_add(project, customer, get_csrf_request_with_db): from autonomie.views.project import ProjectEdit req = get_csrf_request_with_db() req.context = project appstruct = APPSTRUCT.copy() appstruct['customers'] = ["1", customer.id] view = ProjectEdit(req) view.submit_success(appstruct) project = getone() assert(len(project.customers) == 2)
def test_customer_remove(project, get_csrf_request_with_db): from autonomie.views.project import ProjectEdit req = get_csrf_request_with_db() req.context = project appstruct = APPSTRUCT.copy() appstruct["customers"] = [] view = ProjectEdit(req) view.submit_success(appstruct) project = getone() assert (len(project.customers) == 0)
def test_edit(project, get_csrf_request_with_db): from autonomie.views.project import ProjectEdit req = get_csrf_request_with_db() req.context = project appstruct = APPSTRUCT.copy() definition = u"Super project, should e ^dmeù*" appstruct['definition'] = definition view = ProjectEdit(req) view.submit_success(appstruct) project = getone() assert (project.definition == definition)
def test_customer_add(self): self.addOne() project = self.getOne() req = self.get_csrf_request() req.context = project appstruct = APPSTRUCT.copy() appstruct['customers'] = ["1"] view = ProjectEdit(req) view.submit_success(appstruct) project = self.getOne() self.assertEqual(len(project.customers), 1)
def test_customer_remove(self): appstruct = {'name':u'Projéct&$', "code":"ABDC", "customers":["1"]} self.addOne(appstruct) project = self.getOne() req = self.get_csrf_request() req.context = project appstruct["customers"] = [] view = ProjectEdit(req) view.submit_success(appstruct) project = self.getOne() self.assertEqual(len(project.customers), 0)
def test_edit(project, get_csrf_request_with_db): from autonomie.views.project import ProjectEdit req = get_csrf_request_with_db() req.context = project appstruct = APPSTRUCT.copy() definition = u"Super project, should e ^dmeù*" appstruct['definition'] = definition view = ProjectEdit(req) view.submit_success(appstruct) project = getone() assert(project.definition == definition)
def test_edit(self): self.addOne() project = self.getOne() req = self.get_csrf_request() req.context = project appstruct = APPSTRUCT.copy() definition = u"Super project, should e ^dmeù*" appstruct['definition'] = definition view = ProjectEdit(req) view.submit_success(appstruct) project = self.getOne() self.assertEqual(project.definition, definition)
def test_customer_remove(config, get_csrf_request_with_db, project): assert len(project.customers) == 1 from autonomie.views.project import ProjectEdit config.add_route('project', '/') req = get_csrf_request_with_db() req.context = project appstruct = {'name': project.name, "code": project.code, "customers": []} view = ProjectEdit(req) view.submit_success(appstruct) project = getone() assert (len(project.customers) == 0)
def test_edit(config, get_csrf_request_with_db, customer, project): from autonomie.views.project import ProjectEdit config.add_route('project', '/') req = get_csrf_request_with_db() req.context = project definition = u"Super project, should e ^dmeù*" appstruct = { 'name': u'Projéct&$', "code": "ABDC", "customers": [customer.id], 'definition': definition } view = ProjectEdit(req) view.submit_success(appstruct) project = getone() assert (project.definition == definition)