Exemplo n.º 1
0
 def test_make_request_pass(self):
     """Make request call decrements number of requests if out of monthly requests"""
     # pylint:disable=no-self-use
     num_requests = 10
     profile = factories.ProfileFactory(num_requests=num_requests)
     profile.make_request()
     eq_(profile.num_requests, num_requests - 1)
Exemplo n.º 2
0
 def test_pro_invoice_receipt(self, mock_send):
     """A receipt should be sent after a pro subscription payment is made."""
     mock_subscription.plan.id = 'pro'
     customer_id = 'test-pro'
     factories.ProfileFactory(customer_id=customer_id)
     mock_invoice.customer = customer_id
     tasks.send_invoice_receipt(mock_invoice.id)
     mock_send.assert_called_with(fail_silently=False)
Exemplo n.º 3
0
 def test_cancel_legacy_subscription(self):
     """Test ending a pro subscription when missing a subscription ID"""
     # pylint:disable=no-self-use
     pro_profile = factories.ProfileFactory(acct_type='basic',
                                  monthly_requests=settings.MONTHLY_REQUESTS.get('pro'))
     ok_(not pro_profile.subscription_id)
     pro_profile.cancel_pro_subscription()
     eq_(pro_profile.acct_type, 'basic')
     eq_(pro_profile.monthly_requests, settings.MONTHLY_REQUESTS.get('basic'))
Exemplo n.º 4
0
 def test_is_advanced(self):
     """Test whether the users are marked as advanced."""
     beta = factories.ProfileFactory(acct_type='beta')
     proxy = factories.ProfileFactory(acct_type='beta')
     admin = factories.ProfileFactory(acct_type='admin')
     basic = factories.ProfileFactory(acct_type='basic')
     active_org = factories.OrganizationFactory(active=True)
     inactive_org = factories.OrganizationFactory(active=False)
     active_org_member = factories.ProfileFactory(acct_type='basic', organization=active_org)
     inactive_org_member = factories.ProfileFactory(acct_type='basic', organization=inactive_org)
     assert_true(self.profile.is_advanced())
     assert_true(beta.is_advanced())
     assert_true(proxy.is_advanced())
     assert_true(admin.is_advanced())
     assert_true(active_org_member.is_advanced())
     assert_false(basic.is_advanced())
     assert_false(inactive_org_member.is_advanced())
Exemplo n.º 5
0
 def setUp(self):
     self.profile = factories.ProfileFactory(monthly_requests=25, acct_type='pro')
Exemplo n.º 6
0
 def setUp(self):
     self.profile = factories.ProfileFactory()
Exemplo n.º 7
0
 def test_make_request_fail(self):
     """If out of requests, make request returns false"""
     # pylint:disable=no-self-use
     profile = factories.ProfileFactory(num_requests=0)
     profile.date_update = date.today()
     assert_false(profile.make_request())
Exemplo n.º 8
0
 def setUp(self):
     mock_invoice.plan.id = 'pro'
     mock_invoice.attempt_count = 1
     self.profile = factories.ProfileFactory(
         customer_id=mock_invoice.customer)