|
@@ -1,3 +1,4 @@
|
|
|
|
+from ipaddress import IPv4Network
|
|
import re
|
|
import re
|
|
|
|
|
|
from django.conf import settings
|
|
from django.conf import settings
|
|
@@ -209,6 +210,14 @@ class AuthenticatedRRSetTestCase(AuthenticatedRRSetBaseTestCase):
|
|
self.assertStatus(response, status.HTTP_400_BAD_REQUEST)
|
|
self.assertStatus(response, status.HTTP_400_BAD_REQUEST)
|
|
self.assertIn('Ensure this field has no more than 500 characters.', str(response.data))
|
|
self.assertIn('Ensure this field has no more than 500 characters.', str(response.data))
|
|
|
|
|
|
|
|
+ def test_create_my_rr_sets_too_large_rrset(self):
|
|
|
|
+ network = IPv4Network('127.0.0.0/20') # size: 4096 IP addresses
|
|
|
|
+ data = {'records': [str(ip) for ip in network], 'ttl': 3600, 'type': 'A', 'subname': 'name'}
|
|
|
|
+ response = self.client.post_rr_set(self.my_empty_domain.name, **data)
|
|
|
|
+ self.assertStatus(response, status.HTTP_400_BAD_REQUEST)
|
|
|
|
+ excess_length = 28743 + len(self.my_empty_domain.name)
|
|
|
|
+ self.assertIn(f'Total length of RRset exceeds limit by {excess_length} bytes.', str(response.data))
|
|
|
|
+
|
|
def test_create_my_rr_sets_twice(self):
|
|
def test_create_my_rr_sets_twice(self):
|
|
data = {'records': ['1.2.3.4'], 'ttl': 3660, 'type': 'A'}
|
|
data = {'records': ['1.2.3.4'], 'ttl': 3660, 'type': 'A'}
|
|
with self.assertPdnsRequests(self.requests_desec_rr_sets_update(self.my_empty_domain.name)):
|
|
with self.assertPdnsRequests(self.requests_desec_rr_sets_update(self.my_empty_domain.name)):
|