'``ApplicationNodeDeployer.calculate_changes`` specifies that an
application must be started when it is desired on the given node but
not running.'

def test_application_needs_starting(self):

    api = ApplicationNodeDeployer(u'example.com', docker_client=FakeDockerClient(), node_uuid=uuid4())
    application = Application(name=u'mysql-hybridcluster', image=DockerImage(repository=u'clusterhq/flocker', tag=u'release-14.0'))
    nodes = frozenset([Node(uuid=api.node_uuid, applications=frozenset([application]))])
    node_state = NodeState(hostname=api.hostname, uuid=api.node_uuid, applications=[])
    desired = Deployment(nodes=nodes)
    result = api.calculate_changes(desired_configuration=desired, current_cluster_state=DeploymentState(nodes=[node_state]), local_state=NodeLocalState(node_state=node_state))
    expected = sequentially(changes=[in_parallel(changes=[StartApplication(application=application, node_state=node_state)])])
    self.assertEqual(expected, result)
