def test_ota_multiple_stocks(self): user = self.user section_ids = sorted(('stock', 'losses', 'consumption')) amounts = [ SohReport(section_id=section_id, product_id=p._id, amount=i * 10) for section_id in section_ids for i, p in enumerate(self.products) ] report_date = _report_soh(amounts, self.sp.case_id, self.domain.name) balance_blocks = get_ota_balance_xml(self.domain, user) self.assertEqual(3, len(balance_blocks)) for i, section_id in enumerate(section_ids): reports = [ report for report in amounts if report.section_id == section_id ] check_xml_line_by_line( self, balance_ota_block( self.sp, section_id, reports, datestring=report_date, ), balance_blocks[i], )
def test_ota_multiple_stocks(self): user = self.user date = datetime.utcnow() report = StockReport.objects.create( form_id=uuid.uuid4().hex, date=date, type=stockconst.REPORT_TYPE_BALANCE) amounts = [(p._id, i * 10) for i, p in enumerate(self.products)] section_ids = sorted(('stock', 'losses', 'consumption')) for section_id in section_ids: _report_soh(amounts, self.sp._id, section_id, report=report) balance_blocks = get_ota_balance_xml(user) self.assertEqual(3, len(balance_blocks)) for i, section_id in enumerate(section_ids): check_xml_line_by_line( self, balance_ota_block( self.sp, section_id, amounts, datestring=json_format_datetime(date), ), balance_blocks[i], )
def test_ota_multiple_stocks(self): section_ids = sorted(('stock', 'losses', 'consumption')) amounts = [ SohReport(section_id=section_id, product_id=p._id, amount=i * 10) for section_id in section_ids for i, p in enumerate(self.products) ] form_id, report_date = _report_soh(amounts, self.sp.case_id, self.domain.name) self.addCleanup(self.delete_ledger_transactions, form_id) balance_blocks = util.get_ota_balance_xml(self.domain, self.user) self.assertEqual(3, len(balance_blocks)) for i, section_id in enumerate(section_ids): reports = [ report for report in amounts if report.section_id == section_id ] check_xml_line_by_line( self, balance_ota_block( self.sp, section_id, reports, datestring=report_date, ), balance_blocks[i], )
def test_ota_basic(self): user = self.user amounts = [(p._id, i * 10) for i, p in enumerate(self.products)] report = _report_soh(amounts, self.sp.case_id, "stock") check_xml_line_by_line( self, balance_ota_block(self.sp, "stock", amounts, datestring=json_format_datetime(report.date)), get_ota_balance_xml(self.domain, user)[0], )
def test_ota_basic(self): user = self.user amounts = [(p._id, i * 10) for i, p in enumerate(self.products)] report = _report_soh(amounts, self.sp._id, 'stock') check_xml_line_by_line( self, balance_ota_block( self.sp, 'stock', amounts, datestring=json_format_datetime(report.date), ), get_ota_balance_xml(user)[0], )
def test_ota_basic(self): amounts = [ SohReport(section_id='stock', product_id=p._id, amount=i * 10) for i, p in enumerate(self.products) ] report_date = _report_soh(amounts, self.sp.case_id, self.domain.name) check_xml_line_by_line( self, balance_ota_block( self.sp, 'stock', amounts, datestring=report_date, ), util.get_ota_balance_xml(self.domain, self.user)[0], )
def test_ota_basic(self): amounts = [ SohReport(section_id='stock', product_id=p._id, amount=i*10) for i, p in enumerate(self.products) ] report_date = _report_soh(amounts, self.sp.case_id, self.domain.name) check_xml_line_by_line( self, balance_ota_block( self.sp, 'stock', amounts, datestring=report_date, ), util.get_ota_balance_xml(self.domain, self.user)[0], )
def test_ota_multiple_stocks(self): user = self.user date = datetime.utcnow() report = StockReport.objects.create(form_id=uuid.uuid4().hex, date=date, type=stockconst.REPORT_TYPE_BALANCE) amounts = [(p._id, i * 10) for i, p in enumerate(self.products)] section_ids = sorted(("stock", "losses", "consumption")) for section_id in section_ids: _report_soh(amounts, self.sp.case_id, section_id, report=report) balance_blocks = get_ota_balance_xml(self.domain, user) self.assertEqual(3, len(balance_blocks)) for i, section_id in enumerate(section_ids): check_xml_line_by_line( self, balance_ota_block(self.sp, section_id, amounts, datestring=json_format_datetime(date)), balance_blocks[i], )
def test_ota_blank_balances(self): user = self.user self.assertFalse(get_ota_balance_xml(user))
def test_ota_blank_balances(self): user = self.user self.assertFalse(get_ota_balance_xml(self.domain, user))
def test_ota_blank_balances(self): self.assertFalse(util.get_ota_balance_xml(self.domain, self.user))