def assert_calculated_changes(
        case, node_state, node_config, nonmanifest_datasets, expected_changes,
        additional_node_states=frozenset(), leases=Leases(),
        discovered_datasets=None,
):
    api = UnusableAPI()

    deployer = BlockDeviceDeployer(
        node_uuid=node_state.uuid,
        hostname=node_state.hostname,
        block_device_api=api,
    )

    cluster_state = compute_cluster_state(node_state, additional_node_states,
                                          nonmanifest_datasets)

    if discovered_datasets is None:
        local_state = local_state_from_shared_state(
            node_state=node_state,
            nonmanifest_datasets=cluster_state.nonmanifest_datasets,
        )
    else:
        local_state = BlockDeviceDeployerLocalState(
            node_uuid=node_state.uuid,
            hostname=node_state.hostname,
            datasets=dataset_map_from_iterable(discovered_datasets),
        )
        case.assertEqual(
            local_state.shared_state_changes(),
            (node_state.set("applications", None), NonManifestDatasets(
                datasets=cluster_state.nonmanifest_datasets)),
            "Inconsistent test data."
        )

    return assert_calculated_changes_for_deployer(
        case, deployer, node_state, node_config,
        nonmanifest_datasets, additional_node_states, set(),
        expected_changes, local_state, leases=leases,
    )
Assert that ``BlockDeviceDeployer`` calculates certain changes in a certain
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/agents/test/test_blockdevice.py/assert_calculated_changes