示例#1
0
 def test_post_sale_incorrect_item(self, test_app):
     with test_app.app_context():
         sale = SaleDB.create(**TEST_SALE)
         SaleDB.update(id=sale.id, item_id=1)  # Set to nonexistent item id
         with pytest.raises(HTTPError) as err:
             SaleDB.post_sale(sale.id)
         assert '404' in str(err.value)
         assert sale.status == Sale.STATUS_HTTP_ERROR
         assert str(err.value) == sale.error_msg
示例#2
0
 def test_post_sale_no_sdd(self, test_app):
     with test_app.app_context():
         sale = SaleDB.create(**TEST_SALE)
         SaleDB.update(
             id=sale.id,
             user_id=TEST_USER_NO_SDD['id'])  # Set to no sdd user id
         with pytest.raises(api.UserNotSignedException) as err:
             SaleDB.post_sale(sale.id)
         assert '403' in str(err.value) and 'mandate' in str(err.value)
         assert sale.status == Sale.STATUS_SDD_NOT_SIGNED
         assert str(err.value) == sale.error_msg