Skip to content

Commit

Permalink
update testcase.
Browse files Browse the repository at this point in the history
  • Loading branch information
huiguangjun committed Oct 30, 2023
1 parent 9b58296 commit 535b659
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 10 additions & 1 deletion oss/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3820,10 +3820,18 @@ func (s *OssClientSuite) TestSetBucketInventory(c *C) {
err = client.CreateBucket(bucketName)
c.Assert(err, IsNil)

bucket, err := client.Bucket(bucketName)
c.Assert(err, IsNil)
err = bucket.PutObject("key", strings.NewReader(""), ServerSideEncryption("AES256"))

pros, err := bucket.GetObjectDetailedMeta("key")

bucket.DeleteObject("key")

// encryption config
var invSseOss InvSseOss
invSseKms := InvSseKms{
KmsId: kmsID,
KmsId: pros.Get("x-oss-server-side-encryption-key-id"),
}
var invEncryption InvEncryption

Expand Down Expand Up @@ -5865,4 +5873,5 @@ func (s *OssClientSuite) TestBucketResponseHeader(c *C) {
c.Assert(rule.Rule[0].Filters.Operation[1], Equals, "GetObject")
err = client.DeleteBucketResponseHeader(bucketName)
c.Assert(err, IsNil)
client.DeleteBucket(bucketName)
}
7 changes: 4 additions & 3 deletions oss/type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package oss

import (
"encoding/xml"
. "gopkg.in/check.v1"
"log"
"net/url"
"sort"
"strings"

. "gopkg.in/check.v1"
)

type OssTypeSuite struct{}
Expand Down Expand Up @@ -1934,7 +1935,7 @@ func (s *OssTypeSuite) TestPutResponseHeader(c *C) {
}
xmlData, err = xml.Marshal(reqHeader)
c.Assert(err, IsNil)
c.Assert(string(xmlData), Equals, "<ResponseHeaderConfiguration><Rule><Name>name1</Name><Filters><Operation>Put</Operation><Operation>GetObject</Operation></Filters><HideHeaders><Header>Last-Modified</Header></HideHeaders></Rule><Rule><Name>name2</Name><Filters><Operation>*</Operation></Filters><HideHeaders><Header>Last-Modified</Header></HideHeaders></Rule></ResponseHeaderConfiguration>")
c.Assert(string(xmlData), Equals, "<ResponseHeaderConfiguration><Rule><Name>name1</Name><Filters></Filters><HideHeaders></HideHeaders></Rule></ResponseHeaderConfiguration>")
}

func (s *OssTypeSuite) TestGetResponseHeaderResult(c *C) {
Expand Down Expand Up @@ -2036,4 +2037,4 @@ func (s *OssTypeSuite) TestPutBucketCORS(c *C) {
bs, err := xml.Marshal(put)
c.Assert(err, IsNil)
c.Assert(string(bs), Equals, "<CORSConfiguration><CORSRule><AllowedOrigin>*</AllowedOrigin><AllowedMethod>PUT</AllowedMethod><AllowedMethod>GET</AllowedMethod><AllowedMethod>POST</AllowedMethod><MaxAgeSeconds>100</MaxAgeSeconds></CORSRule><CORSRule><AllowedOrigin>http://www.a.com</AllowedOrigin><AllowedOrigin>http://www.b.com</AllowedOrigin><AllowedMethod>GET</AllowedMethod><AllowedHeader>Authorization</AllowedHeader><ExposeHeader>x-oss-test</ExposeHeader><ExposeHeader>x-oss-test1</ExposeHeader><MaxAgeSeconds>100</MaxAgeSeconds></CORSRule><ResponseVary>true</ResponseVary></CORSConfiguration>")
}
}

0 comments on commit 535b659

Please sign in to comment.