def _verify_discover_state_applications(
            self, units, expected_applications,
            current_state=None, start_applications=False):
        if current_state is None:
            current_state = self.EMPTY_NODESTATE
        fake_docker = FakeDockerClient(units=units)
        api = ApplicationNodeDeployer(
            self.hostname,
            node_uuid=self.node_uuid,
            docker_client=fake_docker,
            network=self.network
        )
        if start_applications:
            for app in expected_applications:
                StartApplication(
                    node_state=NodeState(uuid=api.node_uuid,
                                         hostname=api.hostname),
                    application=app
                ).run(api, state_persister=InMemoryStatePersister())
        cluster_state = DeploymentState(nodes={current_state})
        d = api.discover_state(cluster_state,
                               persistent_state=PersistentState())

        self.assertEqual(NodeState(uuid=api.node_uuid, hostname=api.hostname,
                                   applications=expected_applications),
                         self.successResultOf(d).node_state)
Given Docker units, verifies that the correct applications are
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/test/test_container.py/ApplicationNodeDeployerDiscoverNodeConfigurationTests._verify_discover_state_applications