#NEWLINE# @ mock . patch . object ( requests , 'head' , autospec = True ) #NEWLINE# def test_validate_href( self , head_mock ) : #NEWLINE# #INDENT# response = head_mock . return_value #NEWLINE# response . status_code = http_client . OK #NEWLINE# self . service . validate_href ( self . href ) #NEWLINE# head_mock . assert_called_once_with ( self . href ) #NEWLINE# response . status_code = http_client . NO_CONTENT #NEWLINE# self . assertRaises ( exception . ImageRefValidationFailed , self . service . validate_href , self . href ) #NEWLINE# response . status_code = http_client . BAD_REQUEST #NEWLINE# self . assertRaises ( exception . ImageRefValidationFailed , self . service . validate_href , self . href )