Exemplo n.º 1
0
    def test_display_invalid_currency_value(self):
        p = Product(
            **{
                "name": "My test product 2",
                "price": 10000,
                "price_with_tax": 12000,
                "currency": "INVALID",
            })
        db.session.add(p)
        db.session.commit()

        price_display_in_currency_units = p.price_display_in_currency_units()
        self.assertIsNone(price_display_in_currency_units)
Exemplo n.º 2
0
    def test_no_cast(self):
        p = Product(
            **{
                "name": "My test product",
                "price": 10000,
                "price_with_tax": 12000,
                "currency": valuta.EUR.uid,
            })
        db.session.add(p)
        db.session.commit()

        price_in_currency_units = p.price_in_currency_units()
        self.assertEqual(price_in_currency_units, 100)

        price_with_tax_in_currency_units = p.price_with_tax_in_currency_units()
        self.assertEqual(price_with_tax_in_currency_units, 120)
Exemplo n.º 3
0
 def test_display_jpy_format_number(self):
     p = Product(
         **{
             "name": "My test product",
             "price": 1_000,
             "price_with_tax": 1_200,
             "currency": valuta.JPY.uid,
         })
Exemplo n.º 4
0
 def test_1000(self):
     p = Product(
         **{
             "name": "My test product",
             "price": 1_000,
             "price_with_tax": 1_200,
             "currency": valuta.TND.uid,
         })