'``StartApplication.run()`` passes the environment dictionary of the
application to ``DockerClient.add`` as an ``Environment`` instance.'

def test_environment_supplied_to_docker(self):

    fake_docker = FakeDockerClient()
    deployer = ApplicationNodeDeployer(u'example.com', fake_docker)
    application_name = u'site-example.com'
    variables = frozenset({u'foo': u'bar', u'baz': u'qux'}.iteritems())
    application = Application(name=application_name, image=DockerImage(repository=u'clusterhq/postgresql', tag=u'9.3.5'), environment=variables.copy(), links=frozenset(), ports=())
    StartApplication(application=application, node_state=EMPTY_NODESTATE).run(deployer, state_persister=InMemoryStatePersister())
    expected_environment = Environment(variables=variables.copy())
    self.assertEqual(expected_environment, fake_docker._units[application_name].environment)
