'``P2PManifestationDeployer.calculate_changes`` ensures dataset handoff
happens only if there is no application using the dataset that
needs to be moved.
This will eventually be switched to use a lease system, rather
than inspecting application configuration.'

def test_no_handoff_if_in_use(self):

    node_state = NodeState(hostname=u'node1.example.com', manifestations={MANIFESTATION.dataset_id: MANIFESTATION}, paths={}, devices={}, applications={APPLICATION_WITH_VOLUME})
    another_node_state = NodeState(hostname=u'node2.example.com', manifestations={}, devices={}, paths={})
    current = DeploymentState(nodes=[node_state, another_node_state])
    desired = Deployment(nodes={Node(hostname=node_state.hostname), Node(hostname=another_node_state.hostname, manifestations={MANIFESTATION.dataset_id: MANIFESTATION})})
    api = P2PManifestationDeployer(node_state.hostname, create_volume_service(self))
    changes = api.calculate_changes(desired, current, NodeLocalState(node_state=node_state))
    self.assertEqual(NO_CHANGES, changes)
