Example #1
0
    def setUp(self):
        self.user1, self.client1 = create_user('alice',
                                               'Alice',
                                               'Dodgson',
                                               email='*****@*****.**',
                                               is_staff=True)
        self.user2, self.client2 = create_user('bob',
                                               'Bob',
                                               'Albert',
                                               email='*****@*****.**')
        self.user3, self.client3 = create_user('charlie',
                                               'Charlie',
                                               'Tuna',
                                               email='*****@*****.**')

        self.mlist1 = MailingList.objects.create(
            name='Hat Styles',
            description='All about les chapeau',
            subject_prefix='hat',
            email_address='*****@*****.**',
            username='******',
            password='******',
            pop_host='localhost',
            smtp_host='localhost')

        # Basic Packages = just days
        self.day_resource = Resource.objects.create(name="Day Resource")
        self.basicPackage = MembershipPackage.objects.create(name="Basic")
        SubscriptionDefault.objects.create(
            package=self.basicPackage,
            resource=self.day_resource,
            monthly_rate=50,
            allowance=3,
            overage_rate=20,
        )
Example #2
0
    def setUp(self):
        self.user1, self.client1 = create_user('alice',
                                               'Alice',
                                               'Dodgson',
                                               email='*****@*****.**',
                                               is_staff=True)
        self.user2, self.client2 = create_user('bob',
                                               'Bob',
                                               'Albert',
                                               email='*****@*****.**')
        self.user3, self.client3 = create_user('charlie',
                                               'Charlie',
                                               'Tuna',
                                               email='*****@*****.**')
        self.mlist1 = MailingList.objects.create(
            name='Hat Styles',
            description='All about les chapeau',
            subject_prefix='hat',
            email_address='*****@*****.**',
            username='******',
            password='******',
            pop_host='localhost',
            smtp_host='localhost')

        self.basic_plan = MembershipPlan.objects.create(
            name='Basic',
            description='An occasional user',
            monthly_rate='50',
            daily_rate='25',
            dropin_allowance='5')
Example #3
0
 def setUp(self):
    self.user1, self.client1 = create_user('alice', 'Alice', 'Dodgson', is_staff=True)
    self.user2, self.client2 = create_user('bob', 'Bob', 'Albert')
    self.mlist1 = MailingList.objects.create(
       name='Hat Styles', description='All about les chapeau', subject_prefix='hat',
       email_address='*****@*****.**', username='******', password='******',
       pop_host='localhost', smtp_host='localhost'
    )
Example #4
0
 def setUp(self):
    self.user1, self.client1 = create_user('alice', 'Alice', 'Dodgson', email='*****@*****.**', is_staff=True)
    self.user2, self.client2 = create_user('bob', 'Bob', 'Albert', email='*****@*****.**')
    self.mlist1 = MailingList.objects.create(
       name='Hat Styles', description='All about les chapeau', subject_prefix='hat',
       email_address='*****@*****.**', username='******', password='******',
       pop_host='localhost', smtp_host='localhost'
    )
    
    self.basic_plan = MembershipPlan.objects.create(name='Basic', description='An occasional user', monthly_rate='50', daily_rate='25', dropin_allowance='5', deposit_amount='0')
Example #5
0
    def test_opt_out(self):
        self.assertEqual(0, self.mlist1.subscribers.count())
        self.mlist1.is_opt_out = True
        self.mlist1.save()
        user3, _client3 = create_user('suz',
                                      'Suz',
                                      'Ebens',
                                      email='*****@*****.**')
        self.assertEqual(0, self.mlist1.subscribers.count())
        membership = Membership.objects.create(
            member=user3.get_profile(),
            membership_plan=self.basic_plan,
            start_date=timezone.now().date() - timedelta(days=31))
        self.assertEqual(1, self.mlist1.subscribers.count())
        self.assertTrue(user3 in self.mlist1.subscribers.all())

        # Now test that subscribership isn't changed if a member is just changing to a new plan
        membership.end_date = timezone.now().date() - timedelta(days=1)
        membership.save()
        self.mlist1.subscribers.remove(user3)
        _membership2 = Membership.objects.create(
            member=user3.get_profile(),
            membership_plan=self.basic_plan,
            start_date=timezone.now().date())
        self.assertFalse(user3 in self.mlist1.subscribers.all())
Example #6
0
 def test_opt_out(self):
    self.assertEqual(0, self.mlist1.subscribers.count())
    self.mlist1.is_opt_out = True
    self.mlist1.save()
    user3, client3 = create_user('suz', 'Suz', 'Ebens', email='*****@*****.**')
    self.assertEqual(0, self.mlist1.subscribers.count())
    membership = Membership.objects.create(member=user3.get_profile(), membership_plan=self.basic_plan, start_date=date.today() - timedelta(days=31))
    self.assertEqual(1, self.mlist1.subscribers.count())
    self.assertTrue(user3 in self.mlist1.subscribers.all())
Example #7
0
    def setUp(self):
        self.user1, self.client1 = create_user("alice", "Alice", "Dodgson", email="*****@*****.**", is_staff=True)
        self.user2, self.client2 = create_user("bob", "Bob", "Albert", email="*****@*****.**")
        self.user3, self.client3 = create_user("charlie", "Charlie", "Tuna", email="*****@*****.**")
        self.mlist1 = MailingList.objects.create(
            name="Hat Styles",
            description="All about les chapeau",
            subject_prefix="hat",
            email_address="*****@*****.**",
            username="******",
            password="******",
            pop_host="localhost",
            smtp_host="localhost",
        )

        self.basic_plan = MembershipPlan.objects.create(
            name="Basic",
            description="An occasional user",
            monthly_rate="50",
            daily_rate="25",
            dropin_allowance="5",
            deposit_amount="0",
        )
Example #8
0
	def test_opt_out(self):
		self.assertEqual(0, self.mlist1.subscribers.count())
		self.mlist1.is_opt_out = True
		self.mlist1.save()
		user3, _client3 = create_user('suz', 'Suz', 'Ebens', email='*****@*****.**')
		self.assertEqual(0, self.mlist1.subscribers.count())
		membership = Membership.objects.create(member=user3.get_profile(), membership_plan=self.basic_plan, start_date=timezone.now().date() - timedelta(days=31))
		self.assertEqual(1, self.mlist1.subscribers.count())
		self.assertTrue(user3 in self.mlist1.subscribers.all())

		# Now test that subscribership isn't changed if a member is just changing to a new plan
		membership.end_date = timezone.now().date() - timedelta(days=1)
		membership.save()
		self.mlist1.subscribers.remove(user3)
		_membership2 = Membership.objects.create(member=user3.get_profile(), membership_plan=self.basic_plan, start_date=timezone.now().date())
		self.assertFalse(user3 in self.mlist1.subscribers.all())
Example #9
0
    def test_opt_out(self):
        self.assertEqual(0, self.mlist1.subscribers.count())
        self.mlist1.is_opt_out = True
        self.mlist1.save()
        user3, _client3 = create_user('suz',
                                      'Suz',
                                      'Ebens',
                                      email='*****@*****.**')
        self.assertEqual(0, self.mlist1.subscribers.count())
        subscription1 = self.user3.membership.set_to_package(
            self.basicPackage, start_date=today - timedelta(days=31))
        self.assertEqual(1, self.mlist1.subscribers.count())
        self.assertTrue(user3 in self.mlist1.subscribers.all())

        # Now test that subscribership isn't changed if a member is just changing to a new package
        subscription1.end_date = today - timedelta(days=1)
        subscription1.save()
        self.mlist1.subscribers.remove(user3)
        subscription2 = self.user3.membership.set_to_package(self.basicPackage,
                                                             start_date=today)
        self.assertFalse(user3 in self.mlist1.subscribers.all())