vendor: resync with dep ensure
This commit is contained in:
+68
@@ -0,0 +1,68 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/DATA-DOG/godog"
|
||||
|
||||
qs "github.com/yunify/qingstor-sdk-go/service"
|
||||
)
|
||||
|
||||
// ImageFeatureContext provides feature context for image.
|
||||
func ImageFeatureContext(s *godog.Suite) {
|
||||
s.Step(`^image process with key "([^"]*)" and query "([^"]*)"$`, imageProcessWithKeyAndQuery)
|
||||
s.Step(`^image process status code is (\d+)$`, imageProcessStatusCodeIs)
|
||||
|
||||
}
|
||||
|
||||
var imageName string
|
||||
|
||||
func imageProcessWithKeyAndQuery(objectKey, query string) error {
|
||||
if bucket == nil {
|
||||
return errors.New("The bucket is not exist")
|
||||
}
|
||||
file, err := os.Open(path.Join("features", "fixtures", objectKey))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
imageName = objectKey
|
||||
|
||||
_, err = bucket.PutObject(imageName, &qs.PutObjectInput{Body: file})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
output, err := bucket.ImageProcess(objectKey, &qs.ImageProcessInput{
|
||||
Action: &query})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
imageProcessOutput = output
|
||||
return nil
|
||||
}
|
||||
|
||||
var imageProcessOutput *qs.ImageProcessOutput
|
||||
|
||||
func imageProcessStatusCodeIs(statusCode int) error {
|
||||
defer deleteImage(imageName)
|
||||
return checkEqual(qs.IntValue(imageProcessOutput.StatusCode), statusCode)
|
||||
}
|
||||
|
||||
var oOutput *qs.DeleteObjectOutput
|
||||
|
||||
func deleteImage(imageName string) error {
|
||||
|
||||
if bucket == nil {
|
||||
return errors.New("The bucket is not exist")
|
||||
}
|
||||
|
||||
oOutput, err = bucket.DeleteObject(imageName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return checkEqual(qs.IntValue(oOutput.StatusCode), 204)
|
||||
}
|
||||
+1
@@ -41,6 +41,7 @@ func main() {
|
||||
BucketExternalMirrorFeatureContext(s)
|
||||
ObjectFeatureContext(s)
|
||||
ObjectMultipartFeatureContext(s)
|
||||
ImageFeatureContext(s)
|
||||
}
|
||||
options := godog.Options{
|
||||
Format: "pretty",
|
||||
|
||||
+5
@@ -396,6 +396,11 @@ func getObjectWithQuerySignature(objectKey string) error {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
err = r.Build()
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
err = r.SignQuery(10)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
|
||||
Reference in New Issue
Block a user