#NEWLINE# def test_vrf_add_list( self ) : #NEWLINE# #INDENT# ' Add a VRF and verify result in database\n        ' #NEWLINE# attr = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# with self . assertRaisesRegexp ( xmlrpclib . Fault , 'missing attribute rt' ) : #NEWLINE# #INDENT# s . add_vrf ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'attr' : attr , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# attr [ 'rt' ] = '123:456' #NEWLINE# with self . assertRaisesRegexp ( xmlrpclib . Fault , 'missing attribute name' ) : #NEWLINE# #INDENT# s . add_vrf ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'attr' : attr , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# attr [ 'name' ] = 'test' #NEWLINE# attr [ 'tags' ] = [ ] #NEWLINE# attr [ 'description' ] = 'my test vrf' #NEWLINE# attr [ 'avps' ] = { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } #NEWLINE# vrf = s . add_vrf ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'attr' : attr , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertGreater ( vrf [ 'id' ] , 0 ) #NEWLINE# ref = attr . copy ( ) #NEWLINE# ref [ 'id' ] = vrf [ 'id' ] #NEWLINE# self . assertEqual ( self . _mangle_vrf_result ( vrf ) , ref ) #NEWLINE# self . assertEqual ( self . _mangle_vrf_result ( s . list_vrf ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'vrf' : { #NEWLINE# #INDENT# 'id' : vrf [ 'id' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) , [ ref ] ) #NEWLINE# attr [ 'rt' ] = '123:abc' #NEWLINE# with self . assertRaisesRegexp ( xmlrpclib . Fault , '.' ) : #NEWLINE# #INDENT# s . add_vrf ( { #NEWLINE# #INDENT# 'auth' : ad , #NEWLINE# 'attr' : attr , #NEWLINE# #UNINDENT# } )