def test_create(self, set_message): sellable = self.create_sellable() self.create_storable(product=sellable.product) sale_item = TemporarySaleItem(sellable=sellable, quantity=1) user = api.get_current_user(self.store) with mock.patch.object(user.profile, 'check_app_permission') as has_acess: has_acess.side_effect = [False] search = SaleSellableSearch(self.store, sale_items=[sale_item], quantity=1) self.assertRaises(TypeError, SaleSellableSearch, self.store, sale_items=[sale_item], selection_mode=Gtk.SelectionMode.MULTIPLE) self.assertRaises(TypeError, SaleSellableSearch, self.store, sale_items=[sale_item], quantity=None) search = SaleSellableSearch(self.store) search.search.refresh() self.check_search(search, 'sale-sellable-no-filter') search = SaleSellableSearch(self.store, info_message='test') set_message.assert_called_once_with('test') search = SaleSellableSearch(self.store, search_str='cal') self.check_search(search, 'sale-sellable-string-filter')
def test_create(self, set_message): sellable = self.create_sellable() self.create_storable(product=sellable.product) sale_item = TemporarySaleItem(sellable=sellable, quantity=1) search = SaleSellableSearch(self.store, sale_items=[sale_item], quantity=1) self.assertRaises(TypeError, SaleSellableSearch, self.store, sale_items=[sale_item], selection_mode=Gtk.SelectionMode.MULTIPLE) self.assertRaises(TypeError, SaleSellableSearch, self.store, sale_items=[sale_item], quantity=None) search = SaleSellableSearch(self.store) search.search.refresh() self.check_search(search, 'sale-sellable-no-filter') search = SaleSellableSearch(self.store, info_message='test') set_message.assert_called_once_with('test') search = SaleSellableSearch(self.store, search_str='cal') self.check_search(search, 'sale-sellable-string-filter')
def test_add_service_sellable(self, run_dialog): pos = self.create_app(PosApp, u'pos') self._pos_open_till(pos) service = self.create_service() sale_item = TemporarySaleItem(sellable=service.sellable, quantity=2) pos.add_sale_item(sale_item) service.sellable.barcode = u'99991234' pos.barcode.set_text(u'99991234') self.activate(pos.barcode)
def test_add_sale_item(self): app = self.create_app(PosApp, u'pos') pos = app self._pos_open_till(pos) sale_item = TemporarySaleItem(sellable=self.create_sellable(), quantity=1) pos.add_sale_item(sale_item) assert(sale_item in pos.sale_items) self.check_app(app, u'pos-add-sale-item')
def test_add_item_product(self): if True: raise SkipTest( "Producing 'Connection closed error', traceback starting at kiwi. " "Just happen when running all tests, not alone") product = self.create_product() sellable = product.sellable item = self.sale.add_sellable(sellable) self.assertEqual(self.coupon.add_item(item), -1) self.coupon.open() self.coupon.add_item(item) # Item added by the POS app. pos_item = TemporarySaleItem(sellable=sellable, quantity=1) self.coupon.add_item(pos_item)
def _add_product(self, pos, sellable): sale_item = TemporarySaleItem(sellable=sellable, quantity=1) pos.add_sale_item(sale_item) return sale_item