'``StopApplication`` accepts an application object and when ``run()``
is called returns a ``Deferred`` which fires when the container
has been removed.'

def test_stop(self):

    fake_docker = FakeDockerClient()
    api = ApplicationNodeDeployer(u'example.com', docker_client=fake_docker)
    application = Application(name=u'site-example.com', image=DockerImage(repository=u'clusterhq/flocker', tag=u'release-14.0'), links=frozenset())
    StartApplication(application=application, node_state=EMPTY_NODESTATE).run(api, state_persister=InMemoryStatePersister())
    existed = fake_docker.exists(application.name)
    stop_result = StopApplication(application=application).run(api, state_persister=InMemoryStatePersister())
    exists_result = fake_docker.exists(unit_name=application.name)
    self.assertEqual((None, True, False), (self.successResultOf(stop_result), self.successResultOf(existed), self.successResultOf(exists_result)))
