Skip to content

Commit 6a183ed

Browse files
committed
wip test signature form is filled if user logged in
1 parent 5195f83 commit 6a183ed

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pytition/petition/tests/tests_PetitionViews.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ def test_petition_detail(self):
3636
self.assertContains(response, text='<meta property="og:url" content="http://testserver/petition/{}/" />'
3737
.format(petition.id))
3838

39+
def test_fill_petition_when_logged(self):
40+
""" if logged in, the petition form should be pre filled with user account info """
41+
petition = Petition.objects.filter(user__user__username="julia").first()
42+
self.login('john')
43+
response = self.client.get(reverse("detail", args=[petition.id]))
44+
self.assertEqual(response.status_code, 200)
45+
self.assertEqual(response.context['petition'], petition)
46+
self.assertTemplateUsed(response, "petition/petition_detail.html")
47+
48+
form = response.context['form']
49+
self.assertEqual(form.is_bound, True)
50+
self.assertContains(response, text='value="John"')
51+
3952
def test_petition_success_msg(self):
4053
""" Test that the success modal is there when signing and confirming """
4154
petition = Petition.objects.filter(published=True).first()
@@ -228,4 +241,4 @@ def test_petition_unpublish_org(self):
228241
response = self.client.get(reverse("petition_unpublish", args=[petition.id]))
229242
petition.refresh_from_db()
230243
self.assertEqual(response.status_code, 403)
231-
self.assertEqual(petition.published, True)
244+
self.assertEqual(petition.published, True)

0 commit comments

Comments
 (0)