Fix deprecation warnings

This commit is contained in:
Neil Martinsen-Burrell 2023-03-27 12:39:58 -05:00
parent e8b7bfb9c4
commit d3a285b5d8
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
9 changed files with 97 additions and 88 deletions

View file

@ -47,3 +47,5 @@ def less_console_noise():
# restore the streams # restore the streams
for handler in handlers.values(): for handler in handlers.values():
handler.setStream(restore[handler.name]) handler.setStream(restore[handler.name])
# close the file we opened
devnull.close()

View file

@ -8,7 +8,7 @@ from django.conf import settings
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from Cryptodome.PublicKey.RSA import importKey from Cryptodome.PublicKey.RSA import importKey
from jwkest.jwk import RSAKey # type: ignore from jwkest.jwk import RSAKey # type: ignore
from oic import oic, rndstr from oic import oic, rndstr, utils
from oic.oauth2 import ErrorResponse from oic.oauth2 import ErrorResponse
from oic.oic import AuthorizationRequest, AuthorizationResponse, RegistrationResponse from oic.oic import AuthorizationRequest, AuthorizationResponse, RegistrationResponse
from oic.oic.message import AccessTokenResponse from oic.oic.message import AccessTokenResponse
@ -56,7 +56,7 @@ class Client(oic.Client):
client_id=None, client_id=None,
client_authn_method=CLIENT_AUTHN_METHOD, client_authn_method=CLIENT_AUTHN_METHOD,
keyjar=keyjar, keyjar=keyjar,
verify_ssl=verify_ssl, settings=utils.settings.OicClientSettings(verify_ssl=verify_ssl),
config=None, config=None,
) )
# must be set after client is initialized # must be set after client is initialized

View file

@ -47,3 +47,5 @@ def less_console_noise():
# restore the streams # restore the streams
for handler in handlers.values(): for handler in handlers.values():
handler.setStream(restore[handler.name]) handler.setStream(restore[handler.name])
# close the file we opened
devnull.close()

View file

@ -189,6 +189,9 @@ TEMPLATES = [
}, },
] ]
# Stop using table-based default form renderer which is deprecated
FORM_RENDERER = "django.forms.renderers.DjangoDivFormRenderer"
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage" MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
# IS_DEMO_SITE controls whether or not we show our big red "TEST SITE" banner # IS_DEMO_SITE controls whether or not we show our big red "TEST SITE" banner

View file

@ -469,7 +469,7 @@ class DomainApplication(TimeStampedModel):
nothing. nothing.
""" """
if self.submitter is None or self.submitter.email is None: if self.submitter is None or self.submitter.email is None:
logger.warn("Cannot send confirmation email, no submitter email address.") logger.warning("Cannot send confirmation email, no submitter email address.")
return return
try: try:
send_templated_email( send_templated_email(

View file

@ -52,6 +52,8 @@ def less_console_noise():
# restore the streams # restore the streams
for handler in handlers.values(): for handler in handlers.values():
handler.setStream(restore[handler.name]) handler.setStream(restore[handler.name])
# close the file we opened
devnull.close()
class MockUserLogin: class MockUserLogin:

View file

@ -30,7 +30,7 @@ class TestDomainApplication(TestCase):
"""Can create with just a creator.""" """Can create with just a creator."""
user, _ = User.objects.get_or_create() user, _ = User.objects.get_or_create()
application = DomainApplication.objects.create(creator=user) application = DomainApplication.objects.create(creator=user)
self.assertEquals(application.status, DomainApplication.STARTED) self.assertEqual(application.status, DomainApplication.STARTED)
def test_full_create(self): def test_full_create(self):
"""Can create with all fields.""" """Can create with all fields."""
@ -115,13 +115,13 @@ class TestDomain(TestCase):
def test_minimal_create(self): def test_minimal_create(self):
"""Can create with just a name.""" """Can create with just a name."""
domain = Domain.objects.create(name="igorville.gov") domain = Domain.objects.create(name="igorville.gov")
self.assertEquals(domain.is_active, False) self.assertEqual(domain.is_active, False)
def test_get_status(self): def test_get_status(self):
"""Returns proper status based on `is_active`.""" """Returns proper status based on `is_active`."""
domain = Domain.objects.create(name="igorville.gov") domain = Domain.objects.create(name="igorville.gov")
domain.save() domain.save()
self.assertEquals(None, domain.status) self.assertEqual(None, domain.status)
domain.activate() domain.activate()
domain.save() domain.save()
self.assertIn("ok", domain.status) self.assertIn("ok", domain.status)

View file

@ -19,7 +19,7 @@ class TestUserPostSave(TestCase):
def test_user_created_without_matching_contact(self): def test_user_created_without_matching_contact(self):
"""Expect 1 Contact containing data copied from User.""" """Expect 1 Contact containing data copied from User."""
self.assertEquals(len(Contact.objects.all()), 0) self.assertEqual(len(Contact.objects.all()), 0)
user = get_user_model().objects.create( user = get_user_model().objects.create(
username=self.username, username=self.username,
first_name=self.first_name, first_name=self.first_name,
@ -28,14 +28,14 @@ class TestUserPostSave(TestCase):
phone=self.phone, phone=self.phone,
) )
actual = Contact.objects.get(user=user) actual = Contact.objects.get(user=user)
self.assertEquals(actual.first_name, self.first_name) self.assertEqual(actual.first_name, self.first_name)
self.assertEquals(actual.last_name, self.last_name) self.assertEqual(actual.last_name, self.last_name)
self.assertEquals(actual.email, self.email) self.assertEqual(actual.email, self.email)
self.assertEquals(actual.phone, self.phone) self.assertEqual(actual.phone, self.phone)
def test_user_created_with_matching_contact(self): def test_user_created_with_matching_contact(self):
"""Expect 1 Contact associated, but with no data copied from User.""" """Expect 1 Contact associated, but with no data copied from User."""
self.assertEquals(len(Contact.objects.all()), 0) self.assertEqual(len(Contact.objects.all()), 0)
Contact.objects.create( Contact.objects.create(
first_name=self.preferred_first_name, first_name=self.preferred_first_name,
last_name=self.preferred_last_name, last_name=self.preferred_last_name,
@ -49,21 +49,21 @@ class TestUserPostSave(TestCase):
email=self.email, email=self.email,
) )
actual = Contact.objects.get(user=user) actual = Contact.objects.get(user=user)
self.assertEquals(actual.first_name, self.preferred_first_name) self.assertEqual(actual.first_name, self.preferred_first_name)
self.assertEquals(actual.last_name, self.preferred_last_name) self.assertEqual(actual.last_name, self.preferred_last_name)
self.assertEquals(actual.email, self.email) self.assertEqual(actual.email, self.email)
self.assertEquals(actual.phone, self.preferred_phone) self.assertEqual(actual.phone, self.preferred_phone)
def test_user_updated_without_matching_contact(self): def test_user_updated_without_matching_contact(self):
"""Expect 1 Contact containing data copied from User.""" """Expect 1 Contact containing data copied from User."""
# create the user # create the user
self.assertEquals(len(Contact.objects.all()), 0) self.assertEqual(len(Contact.objects.all()), 0)
user = get_user_model().objects.create( user = get_user_model().objects.create(
username=self.username, first_name="", last_name="", email="", phone="" username=self.username, first_name="", last_name="", email="", phone=""
) )
# delete the contact # delete the contact
Contact.objects.all().delete() Contact.objects.all().delete()
self.assertEquals(len(Contact.objects.all()), 0) self.assertEqual(len(Contact.objects.all()), 0)
# modify the user # modify the user
user.username = self.username user.username = self.username
user.first_name = self.first_name user.first_name = self.first_name
@ -73,15 +73,15 @@ class TestUserPostSave(TestCase):
user.save() user.save()
# test # test
actual = Contact.objects.get(user=user) actual = Contact.objects.get(user=user)
self.assertEquals(actual.first_name, self.first_name) self.assertEqual(actual.first_name, self.first_name)
self.assertEquals(actual.last_name, self.last_name) self.assertEqual(actual.last_name, self.last_name)
self.assertEquals(actual.email, self.email) self.assertEqual(actual.email, self.email)
self.assertEquals(actual.phone, self.phone) self.assertEqual(actual.phone, self.phone)
def test_user_updated_with_matching_contact(self): def test_user_updated_with_matching_contact(self):
"""Expect 1 Contact associated, but with no data copied from User.""" """Expect 1 Contact associated, but with no data copied from User."""
# create the user # create the user
self.assertEquals(len(Contact.objects.all()), 0) self.assertEqual(len(Contact.objects.all()), 0)
user = get_user_model().objects.create( user = get_user_model().objects.create(
username=self.username, username=self.username,
first_name=self.first_name, first_name=self.first_name,
@ -97,7 +97,7 @@ class TestUserPostSave(TestCase):
user.save() user.save()
# test # test
actual = Contact.objects.get(user=user) actual = Contact.objects.get(user=user)
self.assertEquals(actual.first_name, self.first_name) self.assertEqual(actual.first_name, self.first_name)
self.assertEquals(actual.last_name, self.last_name) self.assertEqual(actual.last_name, self.last_name)
self.assertEquals(actual.email, self.email) self.assertEqual(actual.email, self.email)
self.assertEquals(actual.phone, self.phone) self.assertEqual(actual.phone, self.phone)

View file

@ -153,11 +153,11 @@ class DomainApplicationTests(TestWithUser, WebTest):
type_result = type_page.form.submit() type_result = type_page.form.submit()
# should see results in db # should see results in db
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.organization_type, "federal") self.assertEqual(application.organization_type, "federal")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(type_result.status_code, 302) self.assertEqual(type_result.status_code, 302)
self.assertEquals(type_result["Location"], "/register/organization_federal/") self.assertEqual(type_result["Location"], "/register/organization_federal/")
num_pages_tested += 1 num_pages_tested += 1
# ---- FEDERAL BRANCH PAGE ---- # ---- FEDERAL BRANCH PAGE ----
@ -172,11 +172,11 @@ class DomainApplicationTests(TestWithUser, WebTest):
federal_result = federal_form.submit() federal_result = federal_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.federal_type, "executive") self.assertEqual(application.federal_type, "executive")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(federal_result.status_code, 302) self.assertEqual(federal_result.status_code, 302)
self.assertEquals(federal_result["Location"], "/register/organization_contact/") self.assertEqual(federal_result["Location"], "/register/organization_contact/")
num_pages_tested += 1 num_pages_tested += 1
# ---- ORG CONTACT PAGE ---- # ---- ORG CONTACT PAGE ----
@ -201,17 +201,17 @@ class DomainApplicationTests(TestWithUser, WebTest):
org_contact_result = org_contact_form.submit() org_contact_result = org_contact_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.organization_name, "Testorg") self.assertEqual(application.organization_name, "Testorg")
self.assertEquals(application.address_line1, "address 1") self.assertEqual(application.address_line1, "address 1")
self.assertEquals(application.address_line2, "address 2") self.assertEqual(application.address_line2, "address 2")
self.assertEquals(application.city, "NYC") self.assertEqual(application.city, "NYC")
self.assertEquals(application.state_territory, "NY") self.assertEqual(application.state_territory, "NY")
self.assertEquals(application.zipcode, "10002") self.assertEqual(application.zipcode, "10002")
self.assertEquals(application.urbanization, "URB Royal Oaks") self.assertEqual(application.urbanization, "URB Royal Oaks")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(org_contact_result.status_code, 302) self.assertEqual(org_contact_result.status_code, 302)
self.assertEquals( self.assertEqual(
org_contact_result["Location"], "/register/authorizing_official/" org_contact_result["Location"], "/register/authorizing_official/"
) )
num_pages_tested += 1 num_pages_tested += 1
@ -232,15 +232,15 @@ class DomainApplicationTests(TestWithUser, WebTest):
ao_result = ao_form.submit() ao_result = ao_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.authorizing_official.first_name, "Testy ATO") self.assertEqual(application.authorizing_official.first_name, "Testy ATO")
self.assertEquals(application.authorizing_official.last_name, "Tester ATO") self.assertEqual(application.authorizing_official.last_name, "Tester ATO")
self.assertEquals(application.authorizing_official.title, "Chief Tester") self.assertEqual(application.authorizing_official.title, "Chief Tester")
self.assertEquals(application.authorizing_official.email, "testy@town.com") self.assertEqual(application.authorizing_official.email, "testy@town.com")
self.assertEquals(application.authorizing_official.phone, "(201) 555 5555") self.assertEqual(application.authorizing_official.phone, "(201) 555 5555")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(ao_result.status_code, 302) self.assertEqual(ao_result.status_code, 302)
self.assertEquals(ao_result["Location"], "/register/current_sites/") self.assertEqual(ao_result["Location"], "/register/current_sites/")
num_pages_tested += 1 num_pages_tested += 1
# ---- CURRENT SITES PAGE ---- # ---- CURRENT SITES PAGE ----
@ -255,14 +255,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
current_sites_result = current_sites_form.submit() current_sites_result = current_sites_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals( self.assertEqual(
application.current_websites.filter(website="http://www.city.com").count(), application.current_websites.filter(website="http://www.city.com").count(),
1, 1,
) )
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(current_sites_result.status_code, 302) self.assertEqual(current_sites_result.status_code, 302)
self.assertEquals(current_sites_result["Location"], "/register/dotgov_domain/") self.assertEqual(current_sites_result["Location"], "/register/dotgov_domain/")
num_pages_tested += 1 num_pages_tested += 1
# ---- DOTGOV DOMAIN PAGE ---- # ---- DOTGOV DOMAIN PAGE ----
@ -277,14 +277,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
dotgov_result = dotgov_form.submit() dotgov_result = dotgov_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.requested_domain.name, "city.gov") self.assertEqual(application.requested_domain.name, "city.gov")
self.assertEquals( self.assertEqual(
application.alternative_domains.filter(website="city1.gov").count(), 1 application.alternative_domains.filter(website="city1.gov").count(), 1
) )
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(dotgov_result.status_code, 302) self.assertEqual(dotgov_result.status_code, 302)
self.assertEquals(dotgov_result["Location"], "/register/purpose/") self.assertEqual(dotgov_result["Location"], "/register/purpose/")
num_pages_tested += 1 num_pages_tested += 1
# ---- PURPOSE PAGE ---- # ---- PURPOSE PAGE ----
@ -299,11 +299,11 @@ class DomainApplicationTests(TestWithUser, WebTest):
purpose_result = purpose_form.submit() purpose_result = purpose_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.purpose, "For all kinds of things.") self.assertEqual(application.purpose, "For all kinds of things.")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(purpose_result.status_code, 302) self.assertEqual(purpose_result.status_code, 302)
self.assertEquals(purpose_result["Location"], "/register/your_contact/") self.assertEqual(purpose_result["Location"], "/register/your_contact/")
num_pages_tested += 1 num_pages_tested += 1
# ---- YOUR CONTACT INFO PAGE ---- # ---- YOUR CONTACT INFO PAGE ----
@ -323,15 +323,15 @@ class DomainApplicationTests(TestWithUser, WebTest):
your_contact_result = your_contact_form.submit() your_contact_result = your_contact_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.submitter.first_name, "Testy you") self.assertEqual(application.submitter.first_name, "Testy you")
self.assertEquals(application.submitter.last_name, "Tester you") self.assertEqual(application.submitter.last_name, "Tester you")
self.assertEquals(application.submitter.title, "Admin Tester") self.assertEqual(application.submitter.title, "Admin Tester")
self.assertEquals(application.submitter.email, "testy-admin@town.com") self.assertEqual(application.submitter.email, "testy-admin@town.com")
self.assertEquals(application.submitter.phone, "(201) 555 5556") self.assertEqual(application.submitter.phone, "(201) 555 5556")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(your_contact_result.status_code, 302) self.assertEqual(your_contact_result.status_code, 302)
self.assertEquals(your_contact_result["Location"], "/register/other_contacts/") self.assertEqual(your_contact_result["Location"], "/register/other_contacts/")
num_pages_tested += 1 num_pages_tested += 1
# ---- OTHER CONTACTS PAGE ---- # ---- OTHER CONTACTS PAGE ----
@ -351,7 +351,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
other_contacts_result = other_contacts_form.submit() other_contacts_result = other_contacts_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals( self.assertEqual(
application.other_contacts.filter( application.other_contacts.filter(
first_name="Testy2", first_name="Testy2",
last_name="Tester2", last_name="Tester2",
@ -363,8 +363,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
) )
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(other_contacts_result.status_code, 302) self.assertEqual(other_contacts_result.status_code, 302)
self.assertEquals(other_contacts_result["Location"], "/register/anything_else/") self.assertEqual(other_contacts_result["Location"], "/register/anything_else/")
num_pages_tested += 1 num_pages_tested += 1
# ---- ANYTHING ELSE PAGE ---- # ---- ANYTHING ELSE PAGE ----
@ -380,11 +380,11 @@ class DomainApplicationTests(TestWithUser, WebTest):
anything_else_result = anything_else_form.submit() anything_else_result = anything_else_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.anything_else, "Nothing else.") self.assertEqual(application.anything_else, "Nothing else.")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(anything_else_result.status_code, 302) self.assertEqual(anything_else_result.status_code, 302)
self.assertEquals(anything_else_result["Location"], "/register/requirements/") self.assertEqual(anything_else_result["Location"], "/register/requirements/")
num_pages_tested += 1 num_pages_tested += 1
# ---- REQUIREMENTS PAGE ---- # ---- REQUIREMENTS PAGE ----
@ -400,11 +400,11 @@ class DomainApplicationTests(TestWithUser, WebTest):
requirements_result = requirements_form.submit() requirements_result = requirements_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.is_policy_acknowledged, True) self.assertEqual(application.is_policy_acknowledged, True)
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the application # the application
self.assertEquals(requirements_result.status_code, 302) self.assertEqual(requirements_result.status_code, 302)
self.assertEquals(requirements_result["Location"], "/register/review/") self.assertEqual(requirements_result["Location"], "/register/review/")
num_pages_tested += 1 num_pages_tested += 1
# ---- REVIEW AND FINSIHED PAGES ---- # ---- REVIEW AND FINSIHED PAGES ----
@ -449,8 +449,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
with less_console_noise(): with less_console_noise():
review_result = review_form.submit() review_result = review_form.submit()
self.assertEquals(review_result.status_code, 302) self.assertEqual(review_result.status_code, 302)
self.assertEquals(review_result["Location"], "/register/finished/") self.assertEqual(review_result["Location"], "/register/finished/")
num_pages_tested += 1 num_pages_tested += 1
# following this redirect is a GET request, so include the cookie # following this redirect is a GET request, so include the cookie
@ -486,8 +486,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
# the post request should return a redirect to the federal branch # the post request should return a redirect to the federal branch
# question # question
self.assertEquals(type_result.status_code, 302) self.assertEqual(type_result.status_code, 302)
self.assertEquals(type_result["Location"], "/register/organization_federal/") self.assertEqual(type_result["Location"], "/register/organization_federal/")
# and the step label should appear in the sidebar of the resulting page # and the step label should appear in the sidebar of the resulting page
# but the step label for the elections page should not appear # but the step label for the elections page should not appear
@ -503,8 +503,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
federal_result = federal_page.form.submit() federal_result = federal_page.form.submit()
# the post request should return a redirect to the contact # the post request should return a redirect to the contact
# question # question
self.assertEquals(federal_result.status_code, 302) self.assertEqual(federal_result.status_code, 302)
self.assertEquals(federal_result["Location"], "/register/organization_contact/") self.assertEqual(federal_result["Location"], "/register/organization_contact/")
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
contact_page = federal_result.follow() contact_page = federal_result.follow()
self.assertContains(contact_page, "Federal agency") self.assertContains(contact_page, "Federal agency")
@ -531,8 +531,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
type_result = type_form.submit() type_result = type_form.submit()
# the post request should return a redirect to the elections question # the post request should return a redirect to the elections question
self.assertEquals(type_result.status_code, 302) self.assertEqual(type_result.status_code, 302)
self.assertEquals(type_result["Location"], "/register/organization_election/") self.assertEqual(type_result["Location"], "/register/organization_election/")
# and the step label should appear in the sidebar of the resulting page # and the step label should appear in the sidebar of the resulting page
# but the step label for the elections page should not appear # but the step label for the elections page should not appear
@ -548,8 +548,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
election_result = election_page.form.submit() election_result = election_page.form.submit()
# the post request should return a redirect to the contact # the post request should return a redirect to the contact
# question # question
self.assertEquals(election_result.status_code, 302) self.assertEqual(election_result.status_code, 302)
self.assertEquals( self.assertEqual(
election_result["Location"], "/register/organization_contact/" election_result["Location"], "/register/organization_contact/"
) )
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
@ -619,8 +619,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
# the post request should return a redirect to the type of work page # the post request should return a redirect to the type of work page
# if it was successful. # if it was successful.
self.assertEquals(contact_result.status_code, 302) self.assertEqual(contact_result.status_code, 302)
self.assertEquals(contact_result["Location"], "/register/type_of_work/") self.assertEqual(contact_result["Location"], "/register/type_of_work/")
def test_application_type_of_work_special(self): def test_application_type_of_work_special(self):
"""Special districts have to answer an additional question.""" """Special districts have to answer an additional question."""
@ -885,7 +885,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
self.assertIn("current_sites-1-website", current_sites_form.fields) self.assertIn("current_sites-1-website", current_sites_form.fields)
# and it is correctly referenced in the ManyToOne relationship # and it is correctly referenced in the ManyToOne relationship
application = DomainApplication.objects.get() # there's only one application = DomainApplication.objects.get() # there's only one
self.assertEquals( self.assertEqual(
application.current_websites.filter(website="https://example.com").count(), application.current_websites.filter(website="https://example.com").count(),
1, 1,
) )