def test_verify_variables_broadcast(self): test_subnet = Subnet() test_subnet.broadcast_address = 0 self.assertFalse(test_subnet.verify_broadcast()) self.assertFalse(test_subnet.verify_variables()) test_subnet.broadcast_address = 'THIS IS A TEST' self.assertFalse(test_subnet.verify_broadcast()) self.assertFalse(test_subnet.verify_variables()) test_subnet.broadcast_address = '152.2.136.0/26' self.assertFalse(test_subnet.verify_broadcast()) self.assertFalse(test_subnet.verify_variables()) test_subnet.broadcast_address = '152.2.136.63' self.assertTrue(test_subnet.verify_broadcast()) self.assertTrue(test_subnet.verify_variables())
def test_general_calculation_network_broadcast(self): test_subnet = Subnet() test_subnet.network_address = '152.2.136.0' test_subnet.broadcast_address = '152.2.136.63' 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_ip_range_from_network_broadcast(self): test_subnet = Subnet() test_subnet.network_address = '152.2.136.0' test_subnet.broadcast_address = '152.2.136.63' test_subnet.calculate_ip_range_from_network_broadcast() self.assertEqual(test_subnet.ip_range, '152.2.136.1-152.2.136.62')