'``StartApplication.run`` returns a `Deferred` which errbacks with
an ``AlreadyExists`` error if there is already a unit with the supplied
application name.'

def test_already_exists(self):

    api = ApplicationNodeDeployer(u'example.com', docker_client=FakeDockerClient())
    application = Application(name=u'site-example.com', image=DockerImage(repository=u'clusterhq/flocker', tag=u'release-14.0'), links=frozenset())
    result1 = StartApplication(application=application, node_state=EMPTY_NODESTATE).run(api, state_persister=InMemoryStatePersister())
    self.successResultOf(result1)
    result2 = StartApplication(application=application, node_state=EMPTY_NODESTATE).run(api, state_persister=InMemoryStatePersister())
    self.failureResultOf(result2, AlreadyExists)
