  def testListDisks(self, mock_get_vm, mock_list_disk, mock_provider):
    """Test that disks from an instance are correctly listed."""
    mock_provider.return_value = azure_mocks.MOCK_CAPACITY_PROVIDER
    mock_get_vm.return_value = mock.Mock(
        storage_profile=mock.Mock(
            os_disk=azure_mocks.MOCK_BOOT_DISK, data_disks=[]))

    # MOCK_LIST_DISKS contains all 2 disks from the subscription
    self.assertEqual(2, len(azure_mocks.MOCK_LIST_DISKS))
    mock_list_disk.return_value = azure_mocks.MOCK_LIST_DISKS

    # The instance is expected to have only a boot disk as we mocked the
    # data_disks attribute with an empty list
    instance_disks = azure_mocks.FAKE_INSTANCE.ListDisks()
    mock_list_disk.assert_called()
    mock_list_disk.assert_called_with(
        resource_group_name=azure_mocks.FAKE_INSTANCE.resource_group_name)
    self.assertEqual(1, len(instance_disks))
    self.assertNotEqual(azure_mocks.MOCK_LIST_DISKS, instance_disks)

    # The instance is expected to have 2 disks as we mocked the
    # data_disks attribute with a non-empty list
    mock_get_vm.return_value = mock.Mock(
        storage_profile=mock.Mock(
            os_disk=azure_mocks.MOCK_BOOT_DISK,
            data_disks=[azure_mocks.MOCK_DISK]))
    instance_disks = azure_mocks.FAKE_INSTANCE.ListDisks()
    mock_list_disk.assert_called()
    mock_list_disk.assert_called_with(
        resource_group_name=azure_mocks.FAKE_INSTANCE.resource_group_name)
    self.assertEqual(2, len(instance_disks))
    self.assertEqual(azure_mocks.MOCK_LIST_DISKS, instance_disks)
Test that disks from an instance are correctly listed.
tests/providers/azure/internal/test_compute.py