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)
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)
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())
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)
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())
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)
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'))