Documentation
¶
Index ¶
- Constants
- Variables
- func CreateStringMetadataField(t *testing.T, prefix string) string
- func DeleteTestMetadataField(t *testing.T, mdFieldExternalID string) string
- func GetServerMock(fn TestFunction) *httptest.Server
- func GetTestSuffix() string
- func SkipFeature(t *testing.T, feature string)
- func SkipFixedFolderMode(t *testing.T)
- func TestDataDir() string
- func UniqueID(prefix string) string
- func UploadTestAsset(t *testing.T, publicID string) *uploader.UploadResult
- func UploadTestVideoAsset(t *testing.T, publicID string)
- type APIResponseTest
- type ExpectedRequestParams
- type TestFunction
Constants ¶
const APIKey = "key"
APIKey is the test API Key.
const APISecret = "secret"
APISecret is the test API Secret.
const APIVersion = "v1_1"
APIVersion is the version of the API.
const AssetID = "4af5a0d1d4047808528b5425d166c101"
AssetID is the test Asset ID.
const AssetID2 = "4af5a0d1d4047808528b5425d166c102"
AssetID2 is another test Asset ID.
const AssetID3 = "4af5a0d1d4047808528b5425d166c103"
AssetID3 is (you won't believe it :)) another test Asset ID.
const Base64Image = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
Base64Image us a base64 encoded test image.
const CloudName = "test123"
CloudName is the test cloud name.
const FileExt = ".bin"
FileExt is the extension of the file.
const Folder = "test_folder"
Folder is the test folder path.
const ImgExt = ".png"
ImgExt is the extension of the image.
const LogoURL = "https://cloudinary-res.cloudinary.com/image/upload/cloudinary_logo.png"
LogoURL is the URL of the publicly available logo.
const NextCursor = "db27cfb02b3f69cb39049969c23ca430c6d33d5a3a7c3ad1d870c54e1a54ee0faa5acdd9f6d288666986001711759d10"
NextCursor is the test cursor.
const PublicID = "go_test_image"
PublicID is the test public ID.
const PublicID2 = "go_test_video_2"
PublicID2 is another test public ID.
const PublicID3 = "go_test_file_3"
PublicID3 is even another test public ID.
const SEOName = "my_favorite_sample"
SEOName is a SEO friendly name.
const SkipDynamicFolders = "dynamic_folders"
SkipDynamicFolders is the name of the dynamic folders feature we want to skip.
const SkipVisualSearch = "visual_search"
SkipVisualSearch is the name of the visual search feature we want to skip.
const Tag1 = "go_tag1"
Tag1 is the test tag.
const Tag2 = "go_tag2"
Tag2 is another test tag.
const Transformation = "c_scale,w_500"
Transformation is the test transfomration.
const VideoExt = ".mp4"
VideoExt is the extension of the video.
const VideoPublicID = "go_test_video"
VideoPublicID is the public ID of the test video.
const VideoURL = "https://res.cloudinary.com/demo/video/upload/dog.mp4"
VideoURL is the URL of the publicly available video.
Variables ¶
var CldContext = map[string]string{"go-context-key": "go-context-value"}
CldContext is the test context.
CldURL is the test CLOUDINARY_URL
var FQPublicID = "image/upload/" + PublicID
FQPublicID is the Fully Qualified test Public ID.
var FQPublicID2 = "video/upload/" + PublicID2
FQPublicID2 is the Fully Qualified test Public ID.
var FQPublicID3 = "raw/upload/" + PublicID3
FQPublicID3 is the Fully Qualified test Public ID.
var ImageFilePath = TestDataDir() + "cloudinary_logo.png"
ImageFilePath is a full path to the test image file.
var ImageInFolder = fmt.Sprintf("%s/%s", Folder, PublicID)
ImageInFolder is the test public ID in folder.
var Tags = []string{Tag1, Tag2}
Tags are the test tags.
var TestSuffix = GetTestSuffix()
TestSuffix is the unique test suffix.
var UniqueFolder = UniqueID(Folder)
UniqueFolder is the unique folder for the current test run.
var VideoFilePath = TestDataDir() + "movie.mp4"
VideoFilePath is a full path to the test video file.
Functions ¶
func CreateStringMetadataField ¶
CreateStringMetadataField creates a test string metadata field.
func DeleteTestMetadataField ¶
DeleteTestMetadataField used to delete test metadata field.
func GetServerMock ¶
func GetServerMock(fn TestFunction) *httptest.Server
GetServerMock Get HTTP server mock
func SkipFeature ¶ added in v2.2.0
func SkipFixedFolderMode ¶ added in v2.9.0
func TestDataDir ¶
func TestDataDir() string
TestDataDir returns the full path to the directory with test files.
func UploadTestAsset ¶
func UploadTestAsset(t *testing.T, publicID string) *uploader.UploadResult
UploadTestAsset uploads a test image asset for test purposes.
func UploadTestVideoAsset ¶
UploadTestVideoAsset uploads a test video asset for test purposes.
Types ¶
type APIResponseTest ¶
APIResponseTest Test function for the response from the API.
type ExpectedRequestParams ¶
type ExpectedRequestParams struct { Method string // Expected HTTP method of the request URI string // Expected URI APIVersion string // Expected API version 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 ¶
type TestFunction func(w http.ResponseWriter, r *http.Request)
TestFunction the test function.
func GetTestHandler ¶
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.