'A valid API request to create a container on an existing node results
in an updated configuration.'

def test_configuration_updated_existing_node(self):

    saving = self.persistence_service.save(Deployment(nodes={Node(uuid=self.NODE_A_UUID, applications={u'postgres': Application(name=u'postgres', image=DockerImage.from_string('postgres'))}), Node(uuid=self.NODE_B_UUID)}))
    saving.addCallback((lambda _: self.assertResponseCode('POST', '/configuration/containers', {u'node_uuid': self.NODE_A, u'name': u'another_postgres', u'image': u'postgres'}, CREATED)))
    def created(_):
        deployment = self.persistence_service.get()
        expected = Deployment(nodes={Node(uuid=self.NODE_A_UUID, applications={a.name: a for a in [Application(name=u'postgres', image=DockerImage.from_string('postgres')), Application(name=u'another_postgres', image=DockerImage.from_string('postgres'))]}), Node(uuid=self.NODE_B_UUID)})
        self.assertEqual(deployment, expected)
    saving.addCallback(created)
    return saving
