statistics_port -> control_port

This commit is contained in:
jeffrey forman 2019-03-17 20:45:15 -04:00
parent 17da7b33a3
commit ab9ad3e25c
3 changed files with 7 additions and 14 deletions

View File

@ -9,11 +9,11 @@ class Form_Tests(TestCase):
def setUp(self): def setUp(self):
self.ns1_key = Key.objects.create(name='test1', data='testdata1234', algorithm='MD5') self.ns1_key = Key.objects.create(name='test1', data='testdata1234', algorithm='MD5')
self.ns1 = BindServer.objects.create(hostname='ns1.test.net', self.ns1 = BindServer.objects.create(hostname='ns1.test.net',
statistics_port=8053, control_port=8053,
default_transfer_key=self.ns1_key) default_transfer_key=self.ns1_key)
self.ns2_key = Key.objects.create(name='test2', data='testdata1234', algorithm='MD5') self.ns2_key = Key.objects.create(name='test2', data='testdata1234', algorithm='MD5')
self.ns2 = BindServer.objects.create(hostname='ns2.test.net', self.ns2 = BindServer.objects.create(hostname='ns2.test.net',
statistics_port=8053, control_port=8053,
default_transfer_key=self.ns2_key) default_transfer_key=self.ns2_key)
def test_Valid_FormAddRecordWithoutReverseRecord(self): def test_Valid_FormAddRecordWithoutReverseRecord(self):

View File

@ -12,24 +12,17 @@ class Model_BindServer_Tests(TestCase):
"""Test that adding a well-formed BindServer works.""" """Test that adding a well-formed BindServer works."""
self.assertEqual(models.BindServer.objects.count(), 0) self.assertEqual(models.BindServer.objects.count(), 0)
bindserver_1 = models.BindServer(hostname="test1", bindserver_1 = models.BindServer(hostname="test1",
statistics_port=1234) control_port=1234)
bindserver_1.save() bindserver_1.save()
self.assertEqual(models.BindServer.objects.count(), 1) self.assertEqual(models.BindServer.objects.count(), 1)
def test_BindServerMissingStatisticsPort(self): def test_BindServerNonIntControlPort(self):
"""Attempt to add a BindServer without a statistics port.""" """Attempt to add a Bindserver with a non-integer control port."""
bindserver_1 = models.BindServer(hostname="badtest1")
with self.assertRaises(IntegrityError):
bindserver_1.save()
def test_BindServerNonIntStatisticsPort(self):
"""Attempt to add a Bindserver with a non-integer statistics port."""
bindserver_1 = models.BindServer(hostname="foo", bindserver_1 = models.BindServer(hostname="foo",
statistics_port="bar1") control_port="bar1")
with self.assertRaisesMessage(ValueError, "invalid literal for int() with base 10: 'bar1'"): with self.assertRaisesMessage(ValueError, "invalid literal for int() with base 10: 'bar1'"):
bindserver_1.save() bindserver_1.save()
class Model_Key_Tests(TestCase): class Model_Key_Tests(TestCase):
def test_KeyModel(self): def test_KeyModel(self):
"""Test that adding a well-formed Key works.""" """Test that adding a well-formed Key works."""

View File

@ -42,7 +42,7 @@ class PostTests(TestCase):
def setUp(self): def setUp(self):
self.client = Client() self.client = Client()
models.BindServer(hostname="testserver.test.net", models.BindServer(hostname="testserver.test.net",
statistics_port=1234).save() control_port=1234).save()
user = User.objects.create_user('testuser', user = User.objects.create_user('testuser',
'testuser@example.com', 'testuser@example.com',