#NEWLINE# def _mangle_prefix_result( self , res ) : #NEWLINE# #INDENT# ' Mangle prefix result for easier testing\n\n            We can never predict the values of things like the ID (okay, that\n            one is actually kind of doable) or the added and last_modified\n            timestamp. This function will make sure the values are present but\n            then strip them to make it easier to test against an expected\n            result.\n\n            All testing of statistics is done in nipaptest.py so we strip that\n            from the result here to make things simple.\n        ' #NEWLINE# if isinstance ( res , list ) : #NEWLINE# #INDENT# for p in res : #NEWLINE# #INDENT# self . assertIn ( 'added' , p ) #NEWLINE# self . assertIn ( 'last_modified' , p ) #NEWLINE# self . assertIn ( 'total_addresses' , p ) #NEWLINE# self . assertIn ( 'used_addresses' , p ) #NEWLINE# self . assertIn ( 'free_addresses' , p ) #NEWLINE# del p [ 'added' ] #NEWLINE# del p [ 'last_modified' ] #NEWLINE# del p [ 'total_addresses' ] #NEWLINE# del p [ 'used_addresses' ] #NEWLINE# del p [ 'free_addresses' ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( res , dict ) and ( 'result' in res ) ) : #NEWLINE# #INDENT# for p in res [ 'result' ] : #NEWLINE# #INDENT# self . assertIn ( 'added' , p ) #NEWLINE# self . assertIn ( 'last_modified' , p ) #NEWLINE# self . assertIn ( 'total_addresses' , p ) #NEWLINE# self . assertIn ( 'used_addresses' , p ) #NEWLINE# self . assertIn ( 'free_addresses' , p ) #NEWLINE# del p [ 'added' ] #NEWLINE# del p [ 'last_modified' ] #NEWLINE# del p [ 'total_addresses' ] #NEWLINE# del p [ 'used_addresses' ] #NEWLINE# del p [ 'free_addresses' ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( res , dict ) : #NEWLINE# #INDENT# self . assertIn ( 'added' , res ) #NEWLINE# self . assertIn ( 'last_modified' , res ) #NEWLINE# self . assertIn ( 'total_addresses' , res ) #NEWLINE# self . assertIn ( 'used_addresses' , res ) #NEWLINE# self . assertIn ( 'free_addresses' , res ) #NEWLINE# del res [ 'added' ] #NEWLINE# del res [ 'last_modified' ] #NEWLINE# del res [ 'total_addresses' ] #NEWLINE# del res [ 'used_addresses' ] #NEWLINE# del res [ 'free_addresses' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return res