예제 #1
0
 def test_reseller_network_propagates_to_sms_settings(self):
     data = self.data.copy()
     data['reseller_network'] = True
     data['plan'] = self.valid_plan.id
     form = CreateSiteForm(data, account=self.account)
     site = form.save()
     site.sms.reseller_network | should | be(True)
예제 #2
0
 def test_reseller_network_propagates_to_sms_settings(self):
     data = self.data.copy()
     data['reseller_network'] = True
     data['plan'] = self.valid_plan.id
     form = CreateSiteForm(data, account=self.account)
     site = form.save()
     site.sms.reseller_network |should| be(True)
예제 #3
0
 def test_invalid_payment_info_invalidates_form(self):
     data = self.data.copy()
     data['plan'] = self.valid_plan.id
     Invoice.objects.create(account=self.account, status=Invoice.STATUS_FAILED)
     form = CreateSiteForm(data, account=self.account)
     self.assertTrue(form.is_bound)
     self.assertFalse(form.is_valid())
     self.assertTrue('Your most recent invoice could not be processed.  Please update your billing information before creating more sites.' in form.non_field_errors())
예제 #4
0
 def test_valid_form_creates_site_and_user(self):
     data = self.data.copy()
     data['plan'] = self.valid_plan.id
     form = CreateSiteForm(data, account=self.account)
     site = form.save()
     self.assertTrue(self.client.login(email=data['email'], password=site.user.username, site=site))
     self.assertEquals(self.client.get('/').status_code, 200)
     self.assertEquals(len(mail.outbox), 1)
     site.sms.reseller_network |should| be(False)
예제 #5
0
 def test_invalid_payment_info_invalidates_form(self):
     data = self.data.copy()
     data['plan'] = self.valid_plan.id
     Invoice.objects.create(account=self.account,
                            status=Invoice.STATUS_FAILED)
     form = CreateSiteForm(data, account=self.account)
     self.assertTrue(form.is_bound)
     self.assertFalse(form.is_valid())
     self.assertTrue(
         'Your most recent invoice could not be processed.  Please update your billing information before creating more sites.'
         in form.non_field_errors())
예제 #6
0
 def test_valid_form_creates_site_and_user(self):
     data = self.data.copy()
     data['plan'] = self.valid_plan.id
     form = CreateSiteForm(data, account=self.account)
     site = form.save()
     self.assertTrue(
         self.client.login(email=data['email'],
                           password=site.user.username,
                           site=site))
     self.assertEquals(self.client.get('/').status_code, 200)
     self.assertEquals(len(mail.outbox), 1)
     site.sms.reseller_network | should | be(False)
예제 #7
0
 def test_plan_choices_restricted_to_account(self):
     data = self.data.copy()
     data['plan'] = self.invalid_plan.id
     form = CreateSiteForm(data, account=self.account)
     self.assertFalse(form.is_valid())
     self.assertTrue(form._errors.has_key('plan'))
예제 #8
0
 def test_plan_choices_restricted_to_account(self):
     data = self.data.copy()
     data['plan'] = self.invalid_plan.id
     form = CreateSiteForm(data, account=self.account)
     self.assertFalse(form.is_valid())
     self.assertTrue(form._errors.has_key('plan'))