def test_delete_device_non_existent_2(self, management_client, inventory_attributes): """ Delete existent device from non-existent group """ d1 = management_client.createDevice(attributes=inventory_attributes) management_client.deleteDeviceInGroup(device=d1, group="404 group", expected_error=True)
def test_delete_device_non_existent_2(self, management_client, internal_client, inventory_attributes): """ Delete existent device from non-existent group """ d1 = "".join([ format(i, "02x") for i in os.urandom(128)]) internal_client.create_device(d1, inventory_attributes) management_client.deleteDeviceInGroup(device=d1, group="404 group", expected_error=True)
def test_delete_device(self, management_client, inventory_attributes): d1 = management_client.createDevice(attributes=inventory_attributes) g1 = "group-test-3" management_client.addDeviceToGroup( device=d1, group=management_client.group(group=g1)) assert len(management_client.getGroupDevices(g1)) == 1 management_client.deleteDeviceInGroup(device=d1, group=g1, expected_error=False) assert len(management_client.getGroupDevices(g1, expected_error=True)) == 0
def test_has_group(self, management_client, inventory_attributes): """ Verify has_group functionality """ did = management_client.createDevice(attributes=inventory_attributes) assert len(management_client.getAllGroups()) == 0 assert len(management_client.getAllDevices(has_group=True)) == 0 group = management_client.group(group="has_group_test_1") management_client.addDeviceToGroup(group=group, device=did) assert len(management_client.getAllDevices(has_group=True)) == 1 management_client.deleteDeviceInGroup(group="has_group_test_1", device=did) assert len(management_client.getAllDevices(has_group=True)) == 0
def test_delete_device(self, management_client, internal_client, inventory_attributes): d1 = "".join([ format(i, "02x") for i in os.urandom(128)]) internal_client.create_device(d1, inventory_attributes) g1 = "group-test-3" management_client.addDeviceToGroup(device=d1, group=management_client.group(group=g1)) assert len(management_client.getGroupDevices(g1)) == 1 management_client.deleteDeviceInGroup(device=d1, group=g1, expected_error=False) assert len(management_client.getGroupDevices(g1, expected_error=True)) == 0
def test_delete_device_non_existent_1(self, management_client): """ Delete non-existent device from non-existent group """ g1 = "group-test-3-non-existent" management_client.deleteDeviceInGroup(device="404 device", group=g1, expected_error=True)