'POSTing to ``/configuration/_compose`` in Flocker\'s custom
configuration format changes the deployment configuration by
parsing the given JSON in Flocker\'s custom configuration format
and using it to replace the existing configuration.'

def configuration_test(self):

    self.cluster_state_service.apply_changes(self.DEPLOYMENT_STATE.nodes.values())
    configuration = {u'applications': COMPLEX_APPLICATION_YAML, u'deployment': COMPLEX_DEPLOYMENT_YAML}
    setting = self.assertResponseCode('POST', '/configuration/_compose', configuration, OK)
    def configuration_set(_):
        actual = self.persistence_service.get()
        apps = FlockerConfiguration(deepcopy(COMPLEX_APPLICATION_YAML)).applications()
        expected = model_from_configuration(self.DEPLOYMENT_STATE, applications=apps, deployment_configuration=deepcopy(COMPLEX_DEPLOYMENT_YAML))
        self.assertEqual(actual, expected)
    setting.addCallback(configuration_set)
    return setting
