def test_create_anon_post(self): url = reverse("pump.story.create.anon") data = dict( name="Patrick", email="*****@*****.**", site=get_site_hatherleigh().pk, title="Chilli Night", description="Hot, hot, hot...", captcha_0="testing", captcha_1="PASSED", ) response = self.client.post(url, data) self.assertEqual(response.status_code, 302) Story.objects.get(name="Patrick")
def test_create_anon_post(self): url = reverse('pump.event.create.anon') data = dict( name='Patrick', email='*****@*****.**', site=get_site_hatherleigh().pk, title='Jazz Night', event_date='06/02/2014', event_time='18:45', description='Our next fund raising event...', captcha_0='testing', captcha_1='PASSED', ) response = self.client.post(url, data) self.assertEqual(response.status_code, 302) Event.objects.get(name='Patrick')
def test_form_clean_description_strong(self): data = dict( name='Patrick', email='*****@*****.**', site=(get_site_hatherleigh().pk, ), title='Chilli Night', description='Hot, <strong>hot</strong>, hot...', captcha_0='testing', captcha_1='PASSED', ) form = StoryAnonForm(data=data) self.assertTrue(form.is_valid(), form.errors) self.assertEquals( 'Hot, <strong>hot</strong>, hot...', form.cleaned_data['description'] )