def test_verify_variables_multiple(self): test_subnet = Subnet() test_subnet.network_address = 'THIS IS A TEST' test_subnet.ip_range = 'THIS IS A TEST' self.assertFalse(test_subnet.verify_variables()) test_subnet.network_address = '152.2.136.0' test_subnet.ip_range = 'THIS IS A TEST' self.assertFalse(test_subnet.verify_variables()) test_subnet.network_address = '152.2.136.0' test_subnet.ip_range = '152.2.136.1-152.2.136.62' self.assertTrue(test_subnet.verify_variables())
def test_verify_variables_ip_range(self): test_subnet = Subnet() test_subnet.ip_range = 0 self.assertFalse(test_subnet.verify_ip_range()) self.assertFalse(test_subnet.verify_variables()) test_subnet.ip_range = 'THIS IS A TEST' self.assertFalse(test_subnet.verify_ip_range()) self.assertFalse(test_subnet.verify_variables()) test_subnet.ip_range = '152.2.136.0/26' self.assertFalse(test_subnet.verify_ip_range()) self.assertFalse(test_subnet.verify_variables()) test_subnet.ip_range = '152.2.136.63' self.assertFalse(test_subnet.verify_ip_range()) self.assertFalse(test_subnet.verify_variables()) test_subnet.ip_range = '152.2.136.0-' self.assertFalse(test_subnet.verify_ip_range()) self.assertFalse(test_subnet.verify_variables()) test_subnet.ip_range = '152.2.136.0-152.2.136.0' self.assertFalse(test_subnet.verify_ip_range()) self.assertFalse(test_subnet.verify_variables()) test_subnet.ip_range = '152.2.136.62-152.2.136.1' self.assertFalse(test_subnet.verify_ip_range()) self.assertFalse(test_subnet.verify_variables()) test_subnet.ip_range = '152.2.136.1-152.2.136.62' self.assertTrue(test_subnet.verify_ip_range()) self.assertTrue(test_subnet.verify_variables())
def test_general_calculation_ip_range(self): test_subnet = Subnet() test_subnet.ip_range = '152.2.136.1-152.2.136.62' test_subnet.general_calculation() self.assertEqual(test_subnet.cidr_address, '152.2.136.0/26') self.assertEqual(test_subnet.netmask, '255.255.255.192') self.assertEqual(test_subnet.network_address, '152.2.136.0') self.assertEqual(test_subnet.broadcast_address, '152.2.136.63') # self.assertEqual(test_subnet.ip_range, '152.2.136.1-152.2.136.62') self.assertEqual(test_subnet.total_host_count, 64) self.assertEqual(test_subnet.assignable_host_count, 62)
def test_reset_variables(self): test_subnet = Subnet() test_subnet.cidr_address = '152.2.136.0/26' test_subnet.network_address = '152.2.136.0' test_subnet.netmask = '255.255.255.192' test_subnet.broadcast_address = '152.2.136.63' test_subnet.ip_range = '152.2.136.1-152.2.136.62' test_subnet.reset_variables() self.assertEqual(test_subnet.cidr_address, '') self.assertEqual(test_subnet.netmask, '') self.assertEqual(test_subnet.network_address, '') self.assertEqual(test_subnet.broadcast_address, '') self.assertEqual(test_subnet.ip_range, '') pass
def test_calculate_total_host_count_from_ip_range(self): test_subnet = Subnet() test_subnet.ip_range = '152.2.136.1-152.2.136.62' test_subnet.calculate_total_host_count_from_ip_range() self.assertEqual(test_subnet.total_host_count, 64)
def test_calculate_broadcast_address_from_ip_range(self): test_subnet = Subnet() test_subnet.ip_range = '152.2.136.1-152.2.136.62' test_subnet.calculate_broadcast_address_from_ip_range() self.assertEqual(test_subnet.broadcast_address, '152.2.136.63')
def test_calculate_network_address_from_ip_range(self): test_subnet = Subnet() test_subnet.ip_range = '152.2.136.1-152.2.136.62' test_subnet.calculate_network_address_from_ip_range() self.assertEqual(test_subnet.network_address, '152.2.136.0')
def test_calculate_netmask_from_ip_range(self): test_subnet = Subnet() test_subnet.ip_range = '152.2.136.1-152.2.136.62' test_subnet.calculate_netmask_from_ip_range() self.assertEqual(test_subnet.netmask, '255.255.255.192')