#NEWLINE# @ mock . patch ( 'api.models.logger' ) #NEWLINE# def test_app_release_notes_in_logs( self , mock_logger ) : #NEWLINE# #INDENT# "Verifies that an app's release summary is dumped into the logs." #NEWLINE# url = '/v1/apps' #NEWLINE# app_name = 'autotest' #NEWLINE# body = { #NEWLINE# #INDENT# 'id' : app_name , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . client . post ( url , json . dumps ( body ) , content_type = 'application/json' , HTTP_AUTHORIZATION = 'token {}' . format ( app . token ) ) #NEWLINE# self . assertEqual ( response . status_code , 201 ) #NEWLINE# app = App . objects . get ( id = app_name ) #NEWLINE# exp_msg = '[{app_name}]: {self.user.username} created initial release' . format ( ** locals ( ) ) #NEWLINE# mock_logger . log . assert_called_with ( logging . INFO , exp_msg ) #NEWLINE# app . log ( 'hello world' ) #NEWLINE# exp_msg = '[{app_name}]: hello world' . format ( ** locals ( ) ) #NEWLINE# mock_logger . log . assert_called_with ( logging . INFO , exp_msg ) #NEWLINE# app . log ( 'goodbye world' , logging . WARNING ) #NEWLINE# exp_msg = '[{app_name}]: goodbye world' . format ( ** locals ( ) ) #NEWLINE# mock_logger . log . assert_called_with ( logging . WARNING , exp_msg )