#NEWLINE# def test_create_container_with_args( self ) : #NEWLINE# #INDENT# mock_conn = self . mox . CreateMockAnything ( ) #NEWLINE# expected_body = jsonutils . dumps ( { #NEWLINE# #INDENT# 'Hostname' : 'marco' , #NEWLINE# 'User' : '' , #NEWLINE# 'Memory' : 512 , #NEWLINE# 'MemorySwap' : 0 , #NEWLINE# 'AttachStdin' : False , #NEWLINE# 'AttachStdout' : False , #NEWLINE# 'AttachStderr' : False , #NEWLINE# 'PortSpecs' : [ ] , #NEWLINE# 'Tty' : True , #NEWLINE# 'OpenStdin' : True , #NEWLINE# 'StdinOnce' : False , #NEWLINE# 'Env' : None , #NEWLINE# 'Cmd' : [ ] , #NEWLINE# 'Dns' : None , #NEWLINE# 'Image' : 'example' , #NEWLINE# 'Volumes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'VolumesFrom' : '' , #NEWLINE# #UNINDENT# } ) #NEWLINE# mock_conn . request ( 'POST' , '/v1.4/containers/create' , body = self , headers = { #NEWLINE# #INDENT# 'Content-Type' : 'application/json' , #NEWLINE# #UNINDENT# } ) #NEWLINE# response = FakeResponse ( 201 , data = '{"id": "XXX"}' , headers = { #NEWLINE# #INDENT# 'Content-Type' : 'application/json' , #NEWLINE# #UNINDENT# } ) #NEWLINE# mock_conn . getresponse ( ) . AndReturn ( response ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# client = nova . virt . docker . client . DockerHTTPClient ( mock_conn ) #NEWLINE# args = { #NEWLINE# #INDENT# 'Hostname' : 'marco' , #NEWLINE# 'Memory' : 512 , #NEWLINE# 'Image' : 'example' , #NEWLINE# #UNINDENT# } #NEWLINE# container_id = client . create_container ( args ) #NEWLINE# self . assertEqual ( 'XXX' , container_id ) #NEWLINE# self . mox . VerifyAll ( )