Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultJWTToken dummy token DefaultJWTToken = "" /* 469-byte string literal not displayed */ )
View Source
const ( // SQLPasswordStorageResponse mocked SQLPasswordStorageResponse = `` /* 130-byte string literal not displayed */ )
Variables ¶
View Source
var ( // RetrieveTokenForbiddenHTTPMock request RetrieveTokenForbiddenHTTPMock = NewMockedHTTPRequest("POST", "/token", forbiddenResponse) // RetrieveAccessTokenHTTPMock request RetrieveAccessTokenHTTPMock = NewMockedHTTPRequest("POST", "/token", accessTokenResponse) // OauthHTTPMock request OauthHTTPMock = NewMockedHTTPRequest("POST", "/o/oauth2/token", oauthResponse) // ImpersonationHTTPMock request ImpersonationHTTPMock = NewMockedHTTPRequest("POST", "/v1/projects/-/serviceAccounts/.*:generateAccessToken", impersonateResponse) ListObjectsHTTPMockFunc = func(bucketName string) MockedHTTPRequest { path := fmt.Sprintf("/storage/v1/b/%s/o", bucketName) return NewMockedHTTPRequest("GET", path, listObjectsResponse) } // ObjectsExistsHTTPMock request ObjectsExistsHTTPMock = NewMockedHTTPRequest("GET", "/storage/v1/b/.*/o", objectsExistsResponse) // SinkNotExistsHTTPMock request SinkNotExistsHTTPMock = NewMockedHTTPRequest("GET", "/storage/v1/b", sinkNotexistsResponse) // BucketAttrsHTTPMock request BucketAttrsHTTPMock = NewMockedHTTPRequest("GET", "/storage/v1/b/.*", bucketAttrsResponse) // PatchBucketAttrsHTTPMock request PatchBucketAttrsHTTPMock = NewMockedHTTPRequest("PATCH", "/storage/v1/b/.*", patchBucketAttrsResponse) BucketSetIAMPolicyHTTPMock = NewMockedHTTPRequest("POST", "/storage/v1/b/.*/iam", bucketSetIAMPolicy) // SinkCreatedHTTPpMock request SinkCreatedHTTPpMock = NewMockedHTTPRequest("POST", "/storage/v1/b", sinkCreatedResponse) // SinkDeletedHTTPMock request SinkDeletedHTTPMock = NewMockedHTTPRequest("DELETE", "/storage/v1/b", sinkDeletedResponse) // DatasetNotAllowedInfoHTTPMock request DatasetNotAllowedInfoHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/datasets/not-allowed-dataset", datasetInfoNotAllowedResponse) // DatasetNotFoundInfoHTTPMock request DatasetNotFoundInfoHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/datasets/unknown-dataset", datasetInfoNotFoundResponse) // DatasetInfoHTTPMock request DatasetInfoHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/datasets/.*", datasetInfoResponse) // TableNotFoundMock request TableNotFoundMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/datasets/.*/tables/notExistingTable", tableInfoNotFoundResponse) // TableInfoHTTPMock request TableInfoHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/datasets/.*/tables/.*", tableInfoResponse) // TablePartitionQueryHTTPMock request TablePartitionQueryHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/datasets/.*/tables/.*/data", hasTablePartitionsResponse) // TablePartitionJobHTTPMock request TablePartitionJobHTTPMock = NewMockedHTTPRequest("POST", "/bigquery/v2/projects/.*/jobs", getTablePartitionsJobResponse) // TablePartitionResultHTTPMock request TablePartitionResultHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/queries", getTablePartitionsQueryResponse) // ExtractJobResultOkHTTPMock request ExtractJobResultOkHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/jobs/.*", getExtractJobResultOkResponse) GetBackUpSourceNotFoundForBigQueryMock = NewMockedHTTPRequest("GET", "bigquery/v2/projects/.*/datasets/notExistingDataset", getBackUpSourceNotFoundResponseForBigQuery) GetBackUpSourceNotFoundForCloudStorageMock = NewMockedHTTPRequest("GET", "/storage/v1/b/notExistingBucket", getBackUpSourceNotFoundResponseForCloudStorage) TableMetadataPartitionResultHTTPMock = NewMockedHTTPRequest("GET", "/bigquery/v2/projects/.*/queries", getMetadataTablePartitionsQueryResponse) )
Functions ¶
Types ¶
type HTTPMockHandler ¶
type HTTPMockHandler struct { }
HTTPMockHandler handles requests
func NewHTTPMockHandler ¶
func NewHTTPMockHandler() *HTTPMockHandler
NewHTTPMockHandler return instance of HTTPMockHandler
func (*HTTPMockHandler) Register ¶
func (h *HTTPMockHandler) Register(httpMocks ...MockedHTTPRequest)
register one or more MockedHTTPRequest
func (*HTTPMockHandler) RegisterLocalServer ¶
func (h *HTTPMockHandler) RegisterLocalServer(localServer string, methods ...string)
RegisterLocalServer set local server
type MockedHTTPRequest ¶
type MockedHTTPRequest struct {
// contains filtered or unexported fields
}
MockedHTTPRequest mock http requests
func NewMockedHTTPRequest ¶
func NewMockedHTTPRequest(method string, path string, response string) MockedHTTPRequest
NewMockedHTTPRequest return instance of MockedHTTPRequest
func NewMockedHTTPRequestWithQuery ¶
func NewMockedHTTPRequestWithQuery(method string, path string, response string, query map[string]string) MockedHTTPRequest
NewMockedHTTPRequestWithQuery return instance of MockedHTTPRequest with query
func (MockedHTTPRequest) String ¶
func (m MockedHTTPRequest) String() string
Click to show internal directories.
Click to hide internal directories.