#NEWLINE# @ pytest . mark . django_db #NEWLINE# def test_record_or_load_records( self , mock_requests , monkeypatch ) : #NEWLINE# #INDENT# mock_requests . request . return_value = mock . Mock ( ok = True , encoding = 'utf-8' , content = 'rawr' , status_code = 200 , headers = { #NEWLINE# #INDENT# 'tota' : 'dyle' , #NEWLINE# #UNINDENT# } ) #NEWLINE# resp = requests . get ( 'dinosaurs.sexy' ) #NEWLINE# model = requests . HarvesterResponse . get ( method = 'get' , url = 'dinosaurs.sexy' ) #NEWLINE# assert ( model . method == 'get' ) #NEWLINE# assert ( model . content == b'rawr' ) #NEWLINE# assert ( model . encoding == 'utf-8' ) #NEWLINE# assert ( model . status_code == 200 ) #NEWLINE# assert ( model . url == 'dinosaurs.sexy' ) #NEWLINE# assert ( model . headers == { #NEWLINE# #INDENT# 'tota' : 'dyle' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( mock_requests . request . called is True ) #NEWLINE# assert ( model . headers_str == '{"tota": "dyle"}' ) #NEWLINE# assert isinstance ( resp , requests . HarvesterResponse )