Ejemplo n.º 1
0
class EUTaxationPolicyTestCase(TestCase):
    def setUp(self):
        self.policy = EUTaxationPolicy()

    def test_none(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, None),
                             Decimal('23.0'))

    def test_private_nonEU(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, 'RU'), None)

    def test_private_EU_same(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, 'PL'),
                             Decimal('23.0'))

    def test_private_EU_notsame(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, 'AT'),
                             Decimal('23.0'))

    def test_company_nonEU(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'RU'), None)

    def test_company_EU_same(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'PL'),
                             Decimal('23.0'))

    @mock.patch("vatnumber.check_vies", lambda x: True)
    def test_company_EU_notsame_vies_ok(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'AT'), None)

    @mock.patch("vatnumber.check_vies", lambda x: False)
    def test_company_EU_notsame_vies_not_ok(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'AT'),
                             Decimal('23.0'))
Ejemplo n.º 2
0
class EUTaxationPolicyTestCase(TestCase):
    def setUp(self):
        self.policy = EUTaxationPolicy()

    def test_none(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, None), Decimal('23.0'))

    def test_private_nonEU(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, 'RU'), None)

    def test_private_EU_same(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, 'PL'), Decimal('23.0'))

    def test_private_EU_notsame(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate(None, 'AT'), Decimal('23.0'))

    def test_company_nonEU(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'RU'), None)

    def test_company_EU_same(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'PL'), Decimal('23.0'))

    @mock.patch("vatnumber.check_vies", lambda x: True)
    def test_company_EU_notsame_vies_ok(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'AT'), None)

    @mock.patch("vatnumber.check_vies", lambda x: False)
    def test_company_EU_notsame_vies_not_ok(self):
        with self.settings(TAX=Decimal('23.0'), TAX_COUNTRY='PL'):
            self.assertEqual(self.policy.get_tax_rate('123456', 'AT'), Decimal('23.0'))
Ejemplo n.º 3
0
 def setUp(self):
     self.policy = EUTaxationPolicy()
Ejemplo n.º 4
0
 def is_UE_customer(self):
     return EUTaxationPolicy.is_in_EU(self.buyer_country.code)
Ejemplo n.º 5
0
 def is_UE_customer(self):
     return EUTaxationPolicy.is_in_EU(self.buyer_country.code)
Ejemplo n.º 6
0
 def setUp(self):
     self.policy = EUTaxationPolicy()