'When doing ``update_node()``, if the given ``NodeState`` has hostname
in existing ``DeploymentState`` node then update all non-``None``
attributes that ``NodeState`` in the new ``Deployment``.'

def test_update_node_replace(self):

    dataset_id = unicode(uuid4())
    manifestation = Manifestation(dataset=Dataset(dataset_id=dataset_id), primary=True)
    end_node = NodeState(hostname=u'node1.example.com', applications={u'site-clusterhq.com': Application(name=u'site-clusterhq.com', image=DockerImage.from_string(u'image'))}, paths={dataset_id: FilePath('/xxx')}, devices={}, manifestations={dataset_id: manifestation})
    update_applications = end_node.update(dict(manifestations=None, paths=None, devices=None))
    update_manifestations = end_node.update(dict(applications=None))
    original = DeploymentState(nodes=[NodeState(hostname=u'node1.example.com')])
    updated = original.update_node(update_applications).update_node(update_manifestations)
    self.assertThat(updated, Equals(DeploymentState(nodes=[end_node])))
