mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-26 01:43:10 +01:00
Make test less dependent on template changes
This commit is contained in:
parent
7b72a2cad2
commit
07f6d5f6c8
@ -1089,17 +1089,28 @@ class EmailInteractionsTestCase(TestCase):
|
|||||||
queue=self.queue_public,
|
queue=self.queue_public,
|
||||||
)
|
)
|
||||||
cat.save()
|
cat.save()
|
||||||
|
attr_list = {
|
||||||
|
"f1_field_title": "KBItem 1",
|
||||||
|
"f1_attr": "kbitem",
|
||||||
|
"f1_attr_value": "1",
|
||||||
|
"f2_attr": "submitter_email",
|
||||||
|
"f2_attr_value": "foo@bar.cz",
|
||||||
|
"f3_attr": "title",
|
||||||
|
"f3_attr_value": "lol",
|
||||||
|
}
|
||||||
self.kbitem1 = KBItem.objects.create(
|
self.kbitem1 = KBItem.objects.create(
|
||||||
category=cat,
|
category=cat,
|
||||||
title="KBItem 1",
|
title=attr_list["f1_field_title"],
|
||||||
question="What?",
|
question="What?",
|
||||||
answer="A KB Item",
|
answer="A KB Item",
|
||||||
)
|
)
|
||||||
self.kbitem1.save()
|
self.kbitem1.save()
|
||||||
cat_url = reverse('helpdesk:submit') + \
|
cat_url = reverse('helpdesk:submit') + '?' \
|
||||||
"?kbitem=1&submitter_email=foo@bar.cz&title=lol"
|
+ attr_list["f1_attr"] + '=' + attr_list["f1_attr_value"] + '&' \
|
||||||
|
+ attr_list["f2_attr"] + '=' + attr_list["f2_attr_value"] + '&' \
|
||||||
|
+ attr_list["f3_attr"] + '=' + attr_list["f3_attr_value"]
|
||||||
response = self.client.get(cat_url)
|
response = self.client.get(cat_url)
|
||||||
|
# Get the rendered response to make it easier to debug if things go wrong
|
||||||
if (
|
if (
|
||||||
hasattr(response, "render")
|
hasattr(response, "render")
|
||||||
and callable(response.render)
|
and callable(response.render)
|
||||||
@ -1114,8 +1125,8 @@ class EmailInteractionsTestCase(TestCase):
|
|||||||
|
|
||||||
msg_prefix = content.decode(response.charset)
|
msg_prefix = content.decode(response.charset)
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response, '<option value="1" selected>KBItem 1</option>', msg_prefix = msg_prefix)
|
response, '<option value="' + attr_list["f1_attr_value"] + '" selected>' + attr_list["f1_field_title"] + '</option>', msg_prefix = msg_prefix)
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response, '<input type="email" name="submitter_email" value="foo@bar.cz" class="form-control form-control" required id="id_submitter_email">', msg_prefix = msg_prefix)
|
response, '<input type="email" name="' + attr_list["f2_attr"] + '" value="' + attr_list["f2_attr_value"], msg_prefix = msg_prefix)
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response, '<input type="text" name="title" value="lol" class="form-control form-control" maxlength="100" required id="id_title">', msg_prefix = msg_prefix)
|
response, '<input type="text" name="' + attr_list["f3_attr"] + '" value="' + attr_list["f3_attr_value"], msg_prefix = msg_prefix)
|
||||||
|
Loading…
Reference in New Issue
Block a user