@@ -78,6 +78,18 @@ func Test_blobDownload_fails_badCreds(t *testing.T) {
7878 Container : "foocontainer" ,
7979 })
8080
81+ mockResponse := & http.Response {
82+ StatusCode : http .StatusForbidden ,
83+ Status : "The chipmunks do not like you and thus returned a 403" ,
84+ }
85+
86+ original := MakeHttpRequest
87+ defer func () { MakeHttpRequest = original }()
88+
89+ MakeHttpRequest = func (* http.Request ) (* http.Response , error ) {
90+ return mockResponse , nil
91+ }
92+
8193 status , _ , err := Download (testctx , d )
8294 require .NotNil (t , err )
8395 require .Contains (t , err .Error (), "Please verify the machine has network connectivity" )
@@ -94,6 +106,18 @@ func Test_blobDownload_fails_badRequest(t *testing.T) {
94106 Container : "foocontainer" ,
95107 }}}
96108
109+ mockResponse := & http.Response {
110+ StatusCode : http .StatusBadRequest ,
111+ Status : "The chipmunks don't understand you. 400." ,
112+ }
113+
114+ original := MakeHttpRequest
115+ defer func () { MakeHttpRequest = original }()
116+
117+ MakeHttpRequest = func (* http.Request ) (* http.Response , error ) {
118+ return mockResponse , nil
119+ }
120+
97121 status , _ , err := Download (testctx , d )
98122 require .NotNil (t , err )
99123 require .Contains (t , err .Error (), "parts of the request were incorrectly formatted, missing, and/or invalid" )
0 commit comments