#NEWLINE# @ pytest . fixture #NEWLINE# def mock_thread( ) : #NEWLINE# #INDENT# base_thrd = { #NEWLINE# #INDENT# 'id' : '5678' , #NEWLINE# 'subject' : 'Test Thread' , #NEWLINE# 'account_id' : MOCK_ACCOUNT_ID , #NEWLINE# 'object' : 'thread' , #NEWLINE# 'folders' : [ { #NEWLINE# #INDENT# 'name' : 'inbox' , #NEWLINE# 'display_name' : 'Inbox' , #NEWLINE# 'id' : 'abcd' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'starred' : True , #NEWLINE# 'unread' : False , #NEWLINE# #UNINDENT# } #NEWLINE# response_body = json . dumps ( base_thrd ) #NEWLINE# def request_callback( request ) : #NEWLINE# #INDENT# payload = json . loads ( request . body ) #NEWLINE# if ( 'folder' in payload ) : #NEWLINE# #INDENT# folder = { #NEWLINE# #INDENT# 'name' : 'test' , #NEWLINE# 'display_name' : 'test' , #NEWLINE# 'id' : payload [ 'folder' ] , #NEWLINE# #UNINDENT# } #NEWLINE# base_thrd [ 'folders' ] = [ folder ] #NEWLINE# #UNINDENT# return ( 200 , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , json . dumps ( base_thrd ) ) #NEWLINE# #UNINDENT# endpoint = re . compile ( ( API_URL + '/threads/5678' ) ) #NEWLINE# responses . add ( responses . GET , endpoint , content_type = 'application/json' , status = 200 , body = response_body ) #NEWLINE# responses . add_callback ( responses . PUT , endpoint , content_type = 'application/json' , callback = request_callback )