def test_delete_interface_non_admin(self): user = factory.make_User() node = factory.make_Node(owner=user, node_type=NODE_TYPE.DEVICE) handler = DeviceHandler(user, {}, None) interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL, node=node) handler.delete_interface( {"system_id": node.system_id, "interface_id": interface.id} ) self.assertIsNone(reload_object(interface))
def test_unlink_subnet(self): user = factory.make_admin() node = factory.make_Node(node_type=NODE_TYPE.DEVICE) handler = DeviceHandler(user, {}) interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL, node=node) link_ip = factory.make_StaticIPAddress( alloc_type=IPADDRESS_TYPE.AUTO, ip="", interface=interface) handler.delete_interface({ "system_id": node.system_id, "interface_id": interface.id, "link_id": link_ip.id, }) self.assertIsNone(reload_object(link_ip))