#NEWLINE# @ attr ( 'categories' ) #NEWLINE# def test_category_lifecycle( self ) : #NEWLINE# #INDENT# cat = WordPressTerm ( ) #NEWLINE# cat . name = 'Test Category' #NEWLINE# cat . taxonomy = 'category' #NEWLINE# cat_id = self . client . call ( taxonomies . NewTerm ( cat ) ) #NEWLINE# self . assertTrue ( cat_id ) #NEWLINE# cat . id = cat_id #NEWLINE# try : #NEWLINE# #INDENT# suggestions = self . client . call ( taxonomies . GetTerms ( 'category' , { #NEWLINE# #INDENT# 'search' : 'test' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertTrue ( isinstance ( suggestions , list ) ) #NEWLINE# found = False #NEWLINE# for suggestion in suggestions : #NEWLINE# #INDENT# if ( suggestion . id == cat_id ) : #NEWLINE# #INDENT# found = True #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# self . assertTrue ( found ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# response = self . client . call ( taxonomies . DeleteTerm ( cat . taxonomy , cat . id ) ) #NEWLINE# self . assertTrue ( response )