def test_has_premium(self): webapp = Webapp(premium_type=amo.ADDON_PREMIUM) webapp._premium = mock.Mock() webapp._premium.price = 1 eq_(webapp.has_premium(), True) webapp._premium.price = 0 eq_(webapp.has_premium(), True)
def test_get_price(self): # This test can be expensive to set up, lets just check it goes # down the stack. webapp = Webapp(premium_type=amo.ADDON_PREMIUM) webapp._premium = mock.Mock() webapp._premium.has_price.return_value = True webapp._premium.get_price.return_value = 1 eq_(webapp.get_price(currency='USD'), 1)
def test_has_price(self): webapp = Webapp(premium_type=amo.ADDON_PREMIUM) webapp._premium = mock.Mock() webapp._premium.price = None webapp._premium.has_price.return_value = True eq_(webapp.has_price(), True) webapp._premium.has_price.return_value = False eq_(webapp.has_price(), False)
def test_has_no_premium(self): webapp = Webapp(premium_type=amo.ADDON_PREMIUM) webapp._premium = None eq_(webapp.has_price(), False)