def test_profile_active_subscription(self): subscription = Subscription() subscription.user = self.user subscription.state = Subscription.STATE_ACTIVE subscription.save() response = self.client.get(reverse('shortener_app:profile')) self.assertTemplateUsed(response, 'shortener_app/profile.html') self.assertContains(response, "You have premium account plan") self.assertEquals(response.status_code, 200)
def test_profile_no_active_subscription(self): subscription = Subscription() subscription.user = self.user subscription.state = Subscription.STATE_CANCELLED subscription.save() response = self.client.get(reverse('shortener_app:profile')) self.assertTemplateUsed(response, 'shortener_app/profile.html') self.assertContains(response, "Price") self.assertEquals(response.status_code, 200)
def test_upgrade_to_premium_user_has_cancelled_subscription(self): subscription = Subscription() subscription.user = self.user subscription.state = Subscription.STATE_CANCELLED subscription.save() response = self.client.get(reverse('shortener_app:upgrade_to_premium')) self.assertTemplateUsed(response, 'shortener_app/upgrade_to_premium.html') self.assertContains(response, "Price") self.assertEquals(response.status_code, 200)