cldtest

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ApiVersion = "v1_1"
View Source
const Base64Image = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"

Base64Image us a base64 encoded test image.

View Source
const FileExt = ".bin"

FileExt is the extension of the file.

View Source
const Folder = "test_folder"

Folder is the test folder path.

View Source
const ImgExt = ".png"

ImgExt is the extension of the image.

View Source
const LogoURL = "https://cloudinary-res.cloudinary.com/image/upload/cloudinary_logo.png"

LogoURL is the URL of the publicly available logo.

View Source
const PublicID = "go_test_image"

PublicID is the test public ID.

View Source
const PublicID2 = "go_test_image_2"

PublicID2 is another test public ID.

View Source
const SEOName = "my_favorite_sample"

SEOName is a SEO friendly name.

View Source
const Tag1 = "go_tag1"

Tag1 is the test tag.

View Source
const Tag2 = "go_tag2"

Tag2 is another test tag.

View Source
const Transformation = "c_scale,w_500"
View Source
const VideoExt = ".mp4"

VideoExt is the extension of the video.

View Source
const VideoPublicID = "go_test_video"

VideoPublicID is the public ID of the test video.

View Source
const VideoURL = "https://res.cloudinary.com/demo/video/upload/dog.mp4"

VideoURL is the URL of the publicly available video.

Variables

View Source
var CldContext = map[string]string{"go-context-key": "go-context-value"}

CldContext is the test context.

View Source
var ImageFilePath = TestDataDir() + "cloudinary_logo.png"

ImageFilePath is a full path to the test image file.

View Source
var ImageInFolder = fmt.Sprintf("%s/%s", Folder, PublicID)

ImageInFolder is the test public ID in folder.

View Source
var Tags = []string{Tag1, Tag2}

Tags are the test tags.

View Source
var TestSuffix = GetTestSuffix()

TestSuffix is the unique test suffix.

View Source
var VideoFilePath = TestDataDir() + "movie.mp4"

VideoFilePath is a full path to the test video file.

Functions

func CreateStringMetadataField added in v1.4.0

func CreateStringMetadataField(t *testing.T, prefix string) string

func DeleteTestMetadataField added in v1.7.0

func DeleteTestMetadataField(t *testing.T, mdFieldExternalID string) string

func GetServerMock added in v1.6.0

func GetServerMock(fn TestFunction) *httptest.Server

GetServerMock Get HTTP server mock

func GetTestSuffix

func GetTestSuffix() string

GetTestSuffix returns a unique test suffix.

func TestDataDir

func TestDataDir() string

TestDataDir returns the full path to the directory with test files.

func UniqueID

func UniqueID(prefix string) string

UniqueID returns a unique ID for the specified prefix.

func UploadTestAsset

func UploadTestAsset(t *testing.T, publicID string) *uploader.UploadResult

UploadTestAsset uploads a test image asset for test purposes.

func UploadTestVideoAsset

func UploadTestVideoAsset(t *testing.T, publicID string)

UploadTestVideoAsset uploads a test video asset for test purposes.

Types

type ApiResponseTest added in v1.6.0

type ApiResponseTest func(response interface{}, t *testing.T)

ApiResponseTest Test function for the response from the API.

type ExpectedRequestParams added in v1.6.0

type ExpectedRequestParams struct {
	Method  string             // Expected HTTP method of the request
	Uri     string             // Expected URI
	Params  *url.Values        // Expected URI params
	Body    *string            // Expected HTTP body (for POST / PUT requests)
	Headers *map[string]string // Expected HTTP request headers
}

ExpectedRequestParams are the expected request parameters

type TestFunction added in v1.6.0

type TestFunction func(w http.ResponseWriter, r *http.Request)

TestFunction the test function.

func GetTestHandler added in v1.6.0

func GetTestHandler(response string, t *testing.T, callCounter *int, ep ExpectedRequestParams) TestFunction

GetTestHandler gets the test handler for HTTP server. Contains basic checks by expected request params.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL