Skip to content

Commit

Permalink
Merge pull request #3973 from open-formulieren/deprecated-asserts
Browse files Browse the repository at this point in the history
🗑️ Update deprecated unittest methods
  • Loading branch information
Viicos authored Mar 7, 2024
2 parents a9fe217 + b385c1f commit e25dac8
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def test_cancel_login(

form_url.args["_digid-message"] = "login-cancelled"

self.assertEquals(
self.assertEqual(
response.redirect_chain[-1],
(form_url.url, 302),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def test_cancel_login(
response = self.client.get(url, follow=True)

form_url.args["_eherkenning-message"] = "login-cancelled"
self.assertEquals(
self.assertEqual(
response.redirect_chain[-1],
(form_url.url, 302),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def test_cancel_login(

form_url.args["_eidas-message"] = "login-cancelled"

self.assertEquals(
self.assertEqual(
response.redirect_chain[-1],
(form_url.url, 302),
)
Expand Down
14 changes: 7 additions & 7 deletions src/openforms/emails/tests/test_confirmation_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def test_send_confirmation_mail_text_kitchensink(self, appointment_plugin_mock):
# process to keep tests sane (random tokens)
text = message.body.rstrip()
text = re.sub(url_exp, "#URL#", text)
self.assertEquals(expected_text, text)
self.assertEqual(expected_text, text)
self.assertNotIn("<a ", text)
self.assertNotIn("<td ", text)
self.assertNotIn("<p ", text)
Expand Down Expand Up @@ -798,7 +798,7 @@ def test_templatetag_alias(self):
"""
).lstrip()

self.assertEquals(expected_text, text)
self.assertEqual(expected_text, text)

def test_confirmation_email_cosign_required(self):
submission = SubmissionFactory.from_components(
Expand Down Expand Up @@ -836,7 +836,7 @@ def test_confirmation_email_cosign_required(self):
"This form will not be processed until it has been co-signed. A co-sign "
"request was sent to %(cosigner_email)s."
) % {"cosigner_email": "[email protected]"}
self.assertEquals(expected_text, text)
self.assertEqual(expected_text, text)

def test_confirmation_email_cosign_not_required_but_filled_in(self):
submission = SubmissionFactory.from_components(
Expand Down Expand Up @@ -874,7 +874,7 @@ def test_confirmation_email_cosign_not_required_but_filled_in(self):
"This form will not be processed until it has been co-signed. A co-sign "
"request was sent to %(cosigner_email)s."
) % {"cosigner_email": "[email protected]"}
self.assertEquals(expected_text, text)
self.assertEqual(expected_text, text)

def test_confirmation_email_cosign_complete(self):
submission = SubmissionFactory.from_components(
Expand Down Expand Up @@ -912,7 +912,7 @@ def test_confirmation_email_cosign_complete(self):
"This email is a confirmation that this form has been co-signed by "
"%(cosigner_email)s and can now be processed."
) % {"cosigner_email": "[email protected]"}
self.assertEquals(expected_text, text)
self.assertEqual(expected_text, text)

def test_confirmation_email_cosign_not_required_and_not_filled_in(self):
submission = SubmissionFactory.from_components(
Expand Down Expand Up @@ -949,7 +949,7 @@ def test_confirmation_email_cosign_not_required_and_not_filled_in(self):

message = mail.outbox[0]
text = message.body.rstrip()
self.assertEquals(text, "Test:")
self.assertEqual(text, "Test:")

def test_confirmation_email_cosign_completed(self):
submission = SubmissionFactory.from_components(
Expand Down Expand Up @@ -986,4 +986,4 @@ def test_confirmation_email_cosign_completed(self):
text = message.body.rstrip()
expected_text = inspect.cleandoc("Test:").lstrip()

self.assertEquals(expected_text, text)
self.assertEqual(expected_text, text)
4 changes: 2 additions & 2 deletions src/openforms/emails/tests/test_send_mail_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def test_send_mail_html(self):
self.assertEqual(message.from_email, "[email protected]")

# text
self.assertEquals(message.body, "My Message\n")
self.assertEqual(message.body, "My Message\n")
self.assertNotIn("<p>", message.body)

# html alternative
self.assertEqual(len(message.alternatives), 1)
content, mime_type = message.alternatives[0]
self.assertEquals(mime_type, "text/html")
self.assertEqual(mime_type, "text/html")
self.assertIn("<p>My Message</p>", content)
self.assertIn("<table", content)

Expand Down
2 changes: 1 addition & 1 deletion src/openforms/forms/tests/test_api_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ def test_detail_shows_translated_values_based_on_cookie(self):

# The form is only translated into English
# assert all values of this Dutch one are empty
self.assert_(
self.assertTrue(
all(literal["value"] == "" for literal in form["literals"].values())
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def test_it_never_sends_bad_headers_regardless_of_what_people_submit(
raise self.failureException("Fetch sent bad headers!") from e

# it should not add any other headers
self.assertEquals(
self.assertEqual(
set(request.headers), {"If-None-Match"}.union(DEFAULT_REQUEST_HEADERS)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,4 @@ def __json__(self):
variable1 = SubmissionValueVariableFactory.create(value=Natural(1337))
stored = SubmissionValueVariable.objects.get(key=variable1.key)

self.assertEquals(stored.value, 1337)
self.assertEqual(stored.value, 1337)
12 changes: 6 additions & 6 deletions src/openforms/translations/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_sets_values_for_passed_args(self):

form = TranslatedFormFactory.create(_language="en", name="my name")

self.assertEquals(form.name_en, "my name")
self.assertEqual(form.name_en, "my name")
self.assertFalse(form.name)
self.assertFalse(form.name_nl)

Expand All @@ -23,7 +23,7 @@ def test_translates_values_created_by_factory_functions(self):

form = TranslatedFormFactory.create(_language="en")

self.assert_(form.name_en)
self.assertTrue(form.name_en)
self.assertFalse(form.name)
self.assertFalse(form.name_nl)

Expand All @@ -46,16 +46,16 @@ def test_can_still_do_explicit_passing(self):

form = TranslatedFormFactory.create(name_en="my name")

self.assertEquals(form.name_en, "my name")
self.assert_(form.name)
self.assertEquals(form.name_nl, form.name)
self.assertEqual(form.name_en, "my name")
self.assertTrue(form.name)
self.assertEqual(form.name_nl, form.name)

def test_ignores_non_modeltranslation_fields(self):
TranslatedFormFactory = make_translated(FormFactory)

form = TranslatedFormFactory.create(slug="Slurm", _language="en")

self.assertEquals(form.slug, "slurm")
self.assertEqual(form.slug, "slurm")
self.assertFalse(getattr(form, "slug_en", False))

def test_does_not_try_to_set_unconfigured_languages(self):
Expand Down
2 changes: 1 addition & 1 deletion src/stuf/stuf_bg/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_all_prefill_attributes_are_mapped(self):
for attribute in FieldChoices:
with self.subTest(attribute=attribute):
glom_target = ATTRIBUTES_TO_STUF_BG_MAPPING.get(attribute)
self.assert_(glom_target, f"unmapped attribute: {attribute}")
self.assertTrue(glom_target, f"unmapped attribute: {attribute}")


@disable_timelinelog()
Expand Down

0 comments on commit e25dac8

Please sign in to comment.