#NEWLINE# def test_net_from_container_v1( self ) : #NEWLINE# #INDENT# def get_project( ) : #NEWLINE# #INDENT# return Project . from_config ( name = 'composetest' , config_data = build_config ( { #NEWLINE# #INDENT# 'web' : { #NEWLINE# #INDENT# 'image' : 'busybox:latest' , #NEWLINE# 'net' : 'container:composetest_net_container' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) , client = self . client ) #NEWLINE# #UNINDENT# with pytest . raises ( ConfigurationError ) as excinfo : #NEWLINE# #INDENT# get_project ( ) #NEWLINE# #UNINDENT# assert ( "container 'composetest_net_container' which does not exist" in excinfo . exconly ( ) ) #NEWLINE# net_container = Container . create ( get_project . client , image = 'busybox:latest' , name = 'composetest_net_container' , command = 'top' , labels = { #NEWLINE# #INDENT# LABEL_PROJECT : 'composetest' , #NEWLINE# #UNINDENT# } ) #NEWLINE# net_container . start ( ) #NEWLINE# project = get_project ( ) #NEWLINE# project . up ( ) #NEWLINE# web = project . get_service ( 'web' ) #NEWLINE# self . assertEqual ( web . network_mode . mode , ( 'container:' + net_container . id ) )