Sfoglia il codice sorgente

fix unit test error

hangzws 7 anni fa
parent
commit
e2a7df5211
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      oss/bucket.go
  2. 1 1
      oss/error_test.go

+ 1 - 1
oss/bucket.go

@@ -457,7 +457,7 @@ func (bucket Bucket) IsObjectExist(objectKey string) (bool, error) {
 
 
 	switch err.(type) {
 	switch err.(type) {
 	case ServiceError:
 	case ServiceError:
-		if err.(ServiceError).StatusCode == 404 && err.(ServiceError).Code == "NoSuchKey" {
+		if err.(ServiceError).StatusCode == 404 {
 			return false, nil
 			return false, nil
 		}
 		}
 	}
 	}

+ 1 - 1
oss/error_test.go

@@ -107,5 +107,5 @@ func (s *OssErrorSuite) TestServiceErrorEndPoint(c *C) {
 	</Error>`
 	</Error>`
 	serverError, _ = serviceErrFromXML([]byte(xmlBodyWithEndPoint), 406, "5C1B595ED51820B569C6A12F")
 	serverError, _ = serviceErrFromXML([]byte(xmlBodyWithEndPoint), 406, "5C1B595ED51820B569C6A12F")
 	errMsg = serverError.Error()
 	errMsg = serverError.Error()
-	c.Assert(strings.Contains(errMsg, "Endpoint=oss-cn-shenzhen.aliyuncs.com"), Equals, false)
+	c.Assert(strings.Contains(errMsg, "Endpoint=oss-cn-shenzhen.aliyuncs.com"), Equals, true)
 }
 }