How to use assert_notify_form method in Kiwi

Best Python code snippet using Kiwi_python

test_views.py

Source:test_views.py Github

copy

Full Screen

...40 }41 def test_show_testplan_edit_page(self):42 response = self.client.get(self.testplan_edit_url)43 self.assertContains(response, _("Edit TestPlan"))44 self.assert_notify_form(response)45 self.assertContains(46 response,47 '<input class="bootstrap-switch" name="is_active" type="checkbox" checked',48 html=False,49 )50 def test_edit_testplan_text_field(self):51 edit_data = self.testplan_edit_data.copy()52 new_text = f"Edited: {self.test_plan_1.text}"53 edit_data["text"] = new_text54 response = self.client.post(self.testplan_edit_url, data=edit_data, follow=True)55 self.assertContains(response, new_text, html=True)56 self.test_plan_1.refresh_from_db()57 self.assertEqual(new_text, self.test_plan_1.text)58 def test_with_invalid_notify_form_value(self):59 # Note: Boolean fields are always valid - either False or True60 # https://github.com/kiwitcms/Kiwi/pull/1677#discussion_r43877617861 # That's why the only way to make the notify formset invalid is to62 # reference a non-existing email_settings ID !!!63 edit_data = self.testplan_edit_data.copy()64 edit_data["email_settings-0-id"] = -165 del edit_data["email_settings-0-auto_to_plan_author"]66 response = self.client.post(self.testplan_edit_url, data=edit_data, follow=True)67 self.assertContains(response, _("Edit TestPlan"))68 self.assertContains(69 response,70 '<input class="bootstrap-switch" name="email_settings-0-auto_to_plan_author" '71 'type="checkbox"',72 html=False,73 )74 def test_with_invalid_product_shows_error(self):75 edit_data = self.testplan_edit_data.copy()76 edit_data["product"] = -177 del edit_data["email_settings-0-auto_to_plan_author"]78 response = self.client.post(self.testplan_edit_url, data=edit_data, follow=True)79 self.assertContains(response, _("Edit TestPlan"))80 self.assertContains(81 response,82 _(83 "Select a valid choice. That choice is not one of the available choices."84 ),85 )86 self.assertContains(87 response,88 '<input class="bootstrap-switch" name="email_settings-0-auto_to_plan_author" '89 'type="checkbox"',90 html=False,91 )92 def test_with_invalid_type_shows_error(self):93 edit_data = self.testplan_edit_data.copy()94 edit_data["type"] = -195 del edit_data["email_settings-0-auto_to_case_owner"]96 response = self.client.post(self.testplan_edit_url, data=edit_data, follow=True)97 self.assertContains(response, _("Edit TestPlan"))98 self.assertContains(99 response,100 _(101 "Select a valid choice. That choice is not one of the available choices."102 ),103 )104 self.assertContains(105 response,106 '<input class="bootstrap-switch" name="email_settings-0-auto_to_case_owner" '107 'type="checkbox"',108 html=False,109 )110 def test_with_invalid_version_shows_error(self):111 edit_data = self.testplan_edit_data.copy()112 # Note: version not assigned to the current Product, that's why113 # it is invalid !114 version = VersionFactory()115 edit_data["product_version"] = version.pk116 response = self.client.post(self.testplan_edit_url, data=edit_data, follow=True)117 self.assertContains(118 response,119 _(120 "Select a valid choice. That choice is not one of the available choices."121 ),122 )123 def assert_notify_form(self, response):124 self.assertContains(125 response,126 '<input class="bootstrap-switch" name="email_settings-0-auto_to_plan_author" '127 'type="checkbox" checked',128 html=False,129 )130 self.assertContains(131 response,132 '<input class="bootstrap-switch" name="email_settings-0-auto_to_case_owner" '133 'type="checkbox" checked',134 html=False,135 )136 self.assertContains(137 response,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kiwi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful