#NEWLINE# def test_links( self ) : #NEWLINE# #INDENT# '\n        ``StartApplication.run()`` passes environment variables to connect to\n        the remote application to ``DockerClient.add``.\n        ' #NEWLINE# fake_docker = FakeDockerClient ( ) #NEWLINE# deployer = ApplicationNodeDeployer ( 'example.com' , fake_docker ) #NEWLINE# application_name = 'site-example.com' #NEWLINE# application = Application ( name = application_name , image = DockerImage ( repository = 'clusterhq/postgresql' , tag = '9.3.5' ) , links = frozenset ( [ Link ( alias = 'alias' , local_port = 80 , remote_port = 8080 ) ] ) ) #NEWLINE# StartApplication ( application = application , node_state = EMPTY_NODESTATE ) . run ( deployer , state_persister = InMemoryStatePersister ( ) ) #NEWLINE# variables = frozenset ( { #NEWLINE# #INDENT# 'ALIAS_PORT_80_TCP' : 'tcp://example.com:8080' , #NEWLINE# 'ALIAS_PORT_80_TCP_ADDR' : 'example.com' , #NEWLINE# 'ALIAS_PORT_80_TCP_PORT' : '8080' , #NEWLINE# 'ALIAS_PORT_80_TCP_PROTO' : 'tcp' , #NEWLINE# #UNINDENT# } . iteritems ( ) ) #NEWLINE# expected_environment = Environment ( variables = variables . copy ( ) ) #NEWLINE# self . assertEqual ( application_name , fake_docker . _units [ application_name ] . environment )