#NEWLINE# def test_get_id_from_name_notfound( self ) : #NEWLINE# #INDENT# name = 'myname' #NEWLINE# reses = { #NEWLINE# #INDENT# 'networks' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# resstr = self . client . serialize ( reses ) #NEWLINE# self . mox . StubOutWithMock ( self . client . httpclient , 'request' ) #NEWLINE# path = getattr ( self . client , 'networks_path' ) #NEWLINE# self . client . httpclient . request ( test_cli20 . MyUrlComparator ( test_cli20 . end_url ( path , ( 'fields=id&name=' + name ) ) , self . client ) , 'GET' , body = None , headers = mox . ContainsKeyValue ( 'X-Auth-Token' , test_cli20 . TOKEN ) ) . AndReturn ( ( test_cli20 . MyResp ( 200 ) , resstr ) ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# exception = self . assertRaises ( exceptions . NotFound , neutronV20 . find_resourceid_by_name_or_id , self . client , 'network' , name ) #NEWLINE# self . assertIn ( 'Unable to find' , exception . message ) #NEWLINE# self . assertEqual ( 404 , exception . status_code )