def test_interfaces(self): self.assertTrue(verifyObject(ITask, Task())) self.assertTrue(verifyObject(IValidatedTask, Estimation())) self.assertTrue(verifyObject(IPaidTask, Invoice())) self.assertTrue(verifyObject(IPaidTask, CancelInvoice())) self.assertTrue(verifyObject(IInvoice, Invoice())) self.assertTrue(verifyObject(IInvoice, CancelInvoice()))
def submit_success(self, appstruct): log.debug("Submitting estimation add") appstruct = get_estimation_dbdatas(appstruct) customer_id = appstruct["task"]['customer_id'] customer = Customer.get(customer_id) estimation = Estimation( self.context.company, customer, self.context, self.context.phases[0], self.request.user, ) estimation = merge_session_with_post( estimation, appstruct['task'] ) try: # Line handling estimation = add_lines_to_estimation(estimation, appstruct) self.dbsession.add(estimation) self.dbsession.flush() estimation = self.set_task_status(estimation) self.session.flash(u"Le devis a bien été ajouté.") except Forbidden, err: self.request.session.flash(err.message, queue='error')
def test_set_number(): est = Estimation() est.project = MagicMock(code="PRO1") est.customer = MagicMock(code="CLI1") est.taskDate = datetime.date(1969, 07, 31) est.set_sequence_number(15) est.set_number() assert est.number == u"PRO1_CLI1_D15_0769"
def estimation(): est = Estimation(**ESTIMATION) for line in LINES: est.lines.append(EstimationLine(**line)) for line in DISCOUNTS: est.discounts.append(DiscountLine(**line)) for line in PAYMENT_LINES: est.payment_lines.append(PaymentLine(**line)) return est
def estimation(project, user, customer, company, phase): est = Estimation( company, customer, project, phase, user, ) for key, value in TASK.items(): setattr(est, key, value) return est
def estimation(project, user, customer, company, phase): est = Estimation( company, customer, project, phase, user, ) for key, value in ESTIMATION.items(): setattr(est, key, value) for line in LINES: est.add_line(TaskLine(**line)) for line in DISCOUNTS: est.discounts.append(DiscountLine(**line)) for line in PAYMENT_LINES: est.payment_lines.append(PaymentLine(**line)) est.mentions = [ TaskMention(label='mention1', title='title1', full_text='text1') ] return est
def test_set_name(): est = Estimation() est.set_sequence_number(5) est.set_name() assert est.name == u"Devis 5"