mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-29 04:23:19 +02:00
updated tests
This commit is contained in:
parent
e92e2567e0
commit
c7124669aa
1 changed files with 27 additions and 22 deletions
|
@ -2547,8 +2547,8 @@ class TestDomainDNSSEC(TestDomainOverview):
|
||||||
domain DNSSEC data and shows a button to Add new record"""
|
domain DNSSEC data and shows a button to Add new record"""
|
||||||
|
|
||||||
page = self.client.get(reverse("domain-dns-dnssec-dsdata", kwargs={"domain_pk": self.domain_dnssec_none.id}))
|
page = self.client.get(reverse("domain-dns-dnssec-dsdata", kwargs={"domain_pk": self.domain_dnssec_none.id}))
|
||||||
self.assertContains(page, "You have no DS data added")
|
self.assertEqual(page.status_code, 200)
|
||||||
self.assertContains(page, "Add new record")
|
self.assertContains(page, "Add DS record")
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_ds_form_loads_with_ds_data(self):
|
def test_ds_form_loads_with_ds_data(self):
|
||||||
|
@ -2556,26 +2556,8 @@ class TestDomainDNSSEC(TestDomainOverview):
|
||||||
domain DNSSEC DS data and shows the data"""
|
domain DNSSEC DS data and shows the data"""
|
||||||
|
|
||||||
page = self.client.get(reverse("domain-dns-dnssec-dsdata", kwargs={"domain_pk": self.domain_dsdata.id}))
|
page = self.client.get(reverse("domain-dns-dnssec-dsdata", kwargs={"domain_pk": self.domain_dsdata.id}))
|
||||||
self.assertContains(page, "DS data record 1")
|
self.assertContains(page, "Add DS record") # assert add form is present
|
||||||
|
self.assertContains(page, "Action") # assert table is present
|
||||||
@less_console_noise_decorator
|
|
||||||
def test_ds_data_form_modal(self):
|
|
||||||
"""When user clicks on save, a modal pops up."""
|
|
||||||
add_data_page = self.app.get(reverse("domain-dns-dnssec-dsdata", kwargs={"domain_pk": self.domain_dsdata.id}))
|
|
||||||
# Assert that a hidden trigger for the modal does not exist.
|
|
||||||
# This hidden trigger will pop on the page when certain condition are met:
|
|
||||||
# 1) Initial form contained DS data, 2) All data is deleted and form is
|
|
||||||
# submitted.
|
|
||||||
self.assertNotContains(add_data_page, "Trigger Disable DNSSEC Modal")
|
|
||||||
# Simulate a delete all data
|
|
||||||
form_data = {}
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("domain-dns-dnssec-dsdata", kwargs={"domain_pk": self.domain_dsdata.id}),
|
|
||||||
data=form_data,
|
|
||||||
)
|
|
||||||
self.assertEqual(response.status_code, 200) # Adjust status code as needed
|
|
||||||
# Now check to see whether the JS trigger for the modal is present on the page
|
|
||||||
self.assertContains(response, "Trigger Disable DNSSEC Modal")
|
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_ds_data_form_submits(self):
|
def test_ds_data_form_submits(self):
|
||||||
|
@ -2643,6 +2625,29 @@ class TestDomainDNSSEC(TestDomainOverview):
|
||||||
result, str(DsDataError(code=DsDataErrorCodes.INVALID_KEYTAG_SIZE)), count=2, status_code=200
|
result, str(DsDataError(code=DsDataErrorCodes.INVALID_KEYTAG_SIZE)), count=2, status_code=200
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@less_console_noise_decorator
|
||||||
|
def test_ds_data_form_invalid_keytag_chars(self):
|
||||||
|
"""DS data form errors with invalid data (key tag not numeric)
|
||||||
|
|
||||||
|
Uses self.app WebTest because we need to interact with forms.
|
||||||
|
"""
|
||||||
|
add_data_page = self.app.get(reverse("domain-dns-dnssec-dsdata", kwargs={"domain_pk": self.domain_dsdata.id}))
|
||||||
|
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||||
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
# first two nameservers are required, so if we empty one out we should
|
||||||
|
# get a form error
|
||||||
|
add_data_page.forms[0]["form-0-key_tag"] = "invalid" # not numeric
|
||||||
|
add_data_page.forms[0]["form-0-algorithm"] = ""
|
||||||
|
add_data_page.forms[0]["form-0-digest_type"] = ""
|
||||||
|
add_data_page.forms[0]["form-0-digest"] = ""
|
||||||
|
result = add_data_page.forms[0].submit()
|
||||||
|
# form submission was a post with an error, response should be a 200
|
||||||
|
# error text appears twice, once at the top of the page, once around
|
||||||
|
# the field.
|
||||||
|
self.assertContains(
|
||||||
|
result, str(DsDataError(code=DsDataErrorCodes.INVALID_KEYTAG_CHARS)), count=2, status_code=200
|
||||||
|
)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_ds_data_form_invalid_digest_chars(self):
|
def test_ds_data_form_invalid_digest_chars(self):
|
||||||
"""DS data form errors with invalid data (digest contains non hexadecimal chars)
|
"""DS data form errors with invalid data (digest contains non hexadecimal chars)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue