def test_check_subscription_validity_invalid(self): subscription = rules.get_or_create_subscription(self.voucher) subscription.stop = self.now - timedelta(hours=PACKAGE_TYPES_HOURS_MAP[subscription.package.package_type]) subscription.save() response = rules.check_subscription_validity(subscription, self.user) self.assertEqual(len(response), 3) self.assertEqual(response[0], 0) subscription.delete()
def test_check_subscription_validity_invalid(self): subscription = rules.get_or_create_subscription(self.voucher) subscription.stop = self.now - timedelta( hours=PACKAGE_TYPES_HOURS_MAP[subscription.package.package_type]) subscription.save() response = rules.check_subscription_validity(subscription, self.user) self.assertEqual(len(response), 3) self.assertEqual(response[0], 0) subscription.delete()
def test_check_subscription_validity_valid(self): subscription = rules.get_or_create_subscription(self.voucher) response = rules.check_subscription_validity(subscription, self.user) self.assertEqual(len(response), 3) self.assertEqual(response[0], 2) subscription.delete()
def test_get_or_create_subscription(self): subscription = rules.get_or_create_subscription(self.voucher) self.assertTrue(isinstance(subscription, PackageSubscription)) subscription.delete()