updated tests to include the nameservererror class, though they are still failing

This commit is contained in:
Alysia Broddrick 2023-10-04 18:21:19 -07:00
parent f15adde712
commit 851c58953b
No known key found for this signature in database
GPG key ID: 03917052CD0F06B7
3 changed files with 9 additions and 6 deletions

View file

@ -20,7 +20,7 @@ class NameserverErrorCodes(IntEnum):
class NameserverError(Exception):
"""
NameserverError class used when to raise exceptions on
NameserverError class used to raise exceptions on
the nameserver getter
"""
@ -30,7 +30,9 @@ class NameserverError(Exception):
NameserverErrorCodes.GLUE_RECORD_NOT_ALLOWED: "Nameserver {} cannot be linked "
"because it is not a subdomain",
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):

View file

@ -848,7 +848,7 @@ class TestRegistrantNameservers(MockEppLib):
(nameserver14,),
]
self.assertRaises(ValueError, _get_14_nameservers)
self.assertRaises(NameserverError, _get_14_nameservers)
self.assertEqual(self.mockedSendFunction.call_count, 0)
def test_user_removes_some_nameservers(self):
@ -1032,7 +1032,7 @@ class TestRegistrantNameservers(MockEppLib):
dotgovnameserver = "my-nameserver.gov"
with self.assertRaises(ValueError):
with self.assertRaises(NameserverError):
self.domain.nameservers = [(dotgovnameserver,)]
def test_user_updates_ips(self):
@ -1101,7 +1101,7 @@ class TestRegistrantNameservers(MockEppLib):
"""
dotgovnameserver = "mynameserverdotgov.gov"
with self.assertRaises(ValueError):
with self.assertRaises(NameserverError):
self.domain.nameservers = [(dotgovnameserver, ["1.2.3"])]
def test_nameservers_are_idempotent(self):

View file

@ -22,7 +22,8 @@ class TestNameserverError(TestCase):
self.assertEqual(nsException.code, nsErrorCodes.MISSING_IP)
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"
expected = "Too many hosts provided, you may not have more than 13 nameservers."