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

def test_no_deletion_if_in_use(self):

    node = Node(uuid=uuid4(), manifestations={MANIFESTATION.dataset_id: MANIFESTATION.transform(('dataset', 'deleted'), True)})
    desired = Deployment(nodes=[node])
    node_state = NodeState(uuid=node.uuid, hostname=u'10.1.1.1', applications={APPLICATION_WITH_VOLUME}, devices={}, paths={}, manifestations={MANIFESTATION.dataset_id: MANIFESTATION})
    current = DeploymentState(nodes=[node_state])
    api = P2PManifestationDeployer(u'10.1.1.1', create_volume_service(self), node_uuid=node.uuid)
    changes = api.calculate_changes(desired, current, NodeLocalState(node_state=node_state))
    self.assertEqual(NO_CHANGES, changes)
