def test_till_history_report(self): from stoqlib.gui.dialogs.tillhistory import TillHistoryDialog dialog = TillHistoryDialog(self.store) till = Till(station=self.current_station, branch=self.current_branch, store=self.store) till.open_till(self.current_user) sale = self.create_sale() sellable = self.create_sellable() sale.add_sellable(sellable, price=100) method = PaymentMethod.get_by_name(self.store, u'bill') payment = method.create_payment(sale.branch, sale.station, Payment.TYPE_IN, sale.group, Decimal(100)) TillEntry(value=25, identifier=20, description=u"Cash In", payment=None, till=till, branch=till.station.branch, station=self.current_station, date=datetime.date(2007, 1, 1), store=self.store) TillEntry(value=-5, identifier=21, description=u"Cash Out", payment=None, till=till, branch=till.station.branch, station=self.current_station, date=datetime.date(2007, 1, 1), store=self.store) TillEntry(value=100, identifier=22, description=sellable.get_description(), payment=payment, till=till, branch=till.station.branch, station=self.current_station, date=datetime.date(2007, 1, 1), store=self.store) till_entry = list(self.store.find(TillEntry, till=till)) today = datetime.date.today().strftime('%x') for item in till_entry: if today in item.description: date = datetime.date(2007, 1, 1).strftime('%x') item.description = item.description.replace(today, date) item.date = datetime.date(2007, 1, 1) dialog.results.append(item) self._diff_expected(TillHistoryReport, 'till-history-report', dialog.results, list(dialog.results))
def test_date_search(self): entry = TillEntry(identifier=1234, description=u'desc', date=localdate(2011, 01, 01).date(), value=Decimal(123.0), till=self.store.find(Till)[0], payment=None, branch=api.get_current_branch(self.store), store=self.store) dialog = TillHistoryDialog(self.store) dialog.date_filter.select(DateSearchFilter.Type.USER_DAY) dialog.date_filter.start_date.update(entry.date) self.click(dialog.search.search_button) self.check_dialog(dialog, 'till-history-dialog-custom-day')
def test_show(self): dialog = TillHistoryDialog(self.store) self.check_dialog(dialog, 'till-history-dialog-show')