#NEWLINE# @ pytest . mark . django_db #NEWLINE# def test_record_or_load_logs_not_ok( self , mock_requests , monkeypatch ) : #NEWLINE# #INDENT# mock_log = mock . Mock ( ) #NEWLINE# monkeypatch . setattr ( requests . events , 'log_to_sentry' , mock_log ) #NEWLINE# mock_requests . request . return_value = mock . Mock ( ok = False , encoding = 'utf-8' , content = 'rawr' , status_code = 400 , headers = { #NEWLINE# #INDENT# 'tota' : 'dyle' , #NEWLINE# #UNINDENT# } ) #NEWLINE# resp = requests . get ( 'dinosaurs.sexy' ) #NEWLINE# mock_log . assert_called_once_with ( 'Got non-ok response code.' , url = 'dinosaurs.sexy' , method = 'get' ) #NEWLINE# assert ( resp . ok is False ) #NEWLINE# assert ( resp . status_code == 400 )