mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-13 21:19:42 +02:00
updated tests to include the nameservererror class, though they are still failing
This commit is contained in:
parent
f15adde712
commit
851c58953b
3 changed files with 9 additions and 6 deletions
|
@ -20,7 +20,7 @@ class NameserverErrorCodes(IntEnum):
|
||||||
|
|
||||||
class NameserverError(Exception):
|
class NameserverError(Exception):
|
||||||
"""
|
"""
|
||||||
NameserverError class used when to raise exceptions on
|
NameserverError class used to raise exceptions on
|
||||||
the nameserver getter
|
the nameserver getter
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -30,7 +30,9 @@ class NameserverError(Exception):
|
||||||
NameserverErrorCodes.GLUE_RECORD_NOT_ALLOWED: "Nameserver {} cannot be linked "
|
NameserverErrorCodes.GLUE_RECORD_NOT_ALLOWED: "Nameserver {} cannot be linked "
|
||||||
"because it is not a subdomain",
|
"because it is not a subdomain",
|
||||||
NameserverErrorCodes.INVALID_IP: "Nameserver {} has an invalid IP address: {}",
|
NameserverErrorCodes.INVALID_IP: "Nameserver {} has an invalid IP address: {}",
|
||||||
NameserverErrorCodes.TOO_MANY_HOSTS: "Too many hosts provided, you may not have more than 13 nameservers.",
|
NameserverErrorCodes.TOO_MANY_HOSTS: (
|
||||||
|
"Too many hosts provided, you may not have more than " "13 nameservers."
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, code=None, nameserver=None, ip=None, **kwargs):
|
def __init__(self, *args, code=None, nameserver=None, ip=None, **kwargs):
|
||||||
|
|
|
@ -848,7 +848,7 @@ class TestRegistrantNameservers(MockEppLib):
|
||||||
(nameserver14,),
|
(nameserver14,),
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertRaises(ValueError, _get_14_nameservers)
|
self.assertRaises(NameserverError, _get_14_nameservers)
|
||||||
self.assertEqual(self.mockedSendFunction.call_count, 0)
|
self.assertEqual(self.mockedSendFunction.call_count, 0)
|
||||||
|
|
||||||
def test_user_removes_some_nameservers(self):
|
def test_user_removes_some_nameservers(self):
|
||||||
|
@ -1032,7 +1032,7 @@ class TestRegistrantNameservers(MockEppLib):
|
||||||
|
|
||||||
dotgovnameserver = "my-nameserver.gov"
|
dotgovnameserver = "my-nameserver.gov"
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(NameserverError):
|
||||||
self.domain.nameservers = [(dotgovnameserver,)]
|
self.domain.nameservers = [(dotgovnameserver,)]
|
||||||
|
|
||||||
def test_user_updates_ips(self):
|
def test_user_updates_ips(self):
|
||||||
|
@ -1101,7 +1101,7 @@ class TestRegistrantNameservers(MockEppLib):
|
||||||
"""
|
"""
|
||||||
dotgovnameserver = "mynameserverdotgov.gov"
|
dotgovnameserver = "mynameserverdotgov.gov"
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(NameserverError):
|
||||||
self.domain.nameservers = [(dotgovnameserver, ["1.2.3"])]
|
self.domain.nameservers = [(dotgovnameserver, ["1.2.3"])]
|
||||||
|
|
||||||
def test_nameservers_are_idempotent(self):
|
def test_nameservers_are_idempotent(self):
|
||||||
|
|
|
@ -22,7 +22,8 @@ class TestNameserverError(TestCase):
|
||||||
self.assertEqual(nsException.code, nsErrorCodes.MISSING_IP)
|
self.assertEqual(nsException.code, nsErrorCodes.MISSING_IP)
|
||||||
|
|
||||||
def test_with_only_code(self):
|
def test_with_only_code(self):
|
||||||
"""Test NameserverError when no ip address or nameserver is passed, only the code value"""
|
"""Test NameserverError when no ip address
|
||||||
|
and no nameserver is passed"""
|
||||||
nameserver = "nameserver val"
|
nameserver = "nameserver val"
|
||||||
expected = "Too many hosts provided, you may not have more than 13 nameservers."
|
expected = "Too many hosts provided, you may not have more than 13 nameservers."
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue