juju: github.com/juju/juju/provider/azure/internal/azuretesting Index | Files

package azuretesting

import "github.com/juju/juju/provider/azure/internal/azuretesting"

Index

Package Files

json.go recorder.go senders.go storage.go

func JsonMarshalRaw Uses

func JsonMarshalRaw(v interface{}, allow ...reflect.Type) ([]byte, error)

JsonMarshalRaw does the same a json.Marshal, except that it does not use the MarshalJSON methods of the value being marshaled. If any types are specified in the allow set then those will use their MarshalJSON method.

Many of the types in the Azure SDK have MarshalJSON which skip over fields that are marked as READ-ONLY, this is useful for the client, but a problem when pretending to be a server.

func RequestRecorder Uses

func RequestRecorder(requests *[]*http.Request) autorest.PrepareDecorator

RequestRecorder returns an autorest.PrepareDecorator that records requests to ghe given slice.

type MockSender Uses

type MockSender struct {
    *mocks.Sender

    // PathPattern, if non-empty, is assumed to be a regular expression
    // that must match the request path.
    PathPattern string
}

MockSender is a wrapper around autorest/mocks.Sender, extending it with request path checking to ease testing.

func NewSenderWithValue Uses

func NewSenderWithValue(v interface{}) *MockSender

NewSenderWithValue returns a *mocks.Sender that marshals the provided object to JSON and sets it as the content. This function will panic if marshalling fails.

func (*MockSender) Do Uses

func (s *MockSender) Do(req *http.Request) (*http.Response, error)

type MockStorageBlob Uses

type MockStorageBlob struct {
    testing.Stub
    Name_       string
    Properties_ storage.BlobProperties
}

func (*MockStorageBlob) DeleteIfExists Uses

func (c *MockStorageBlob) DeleteIfExists(opts *storage.DeleteBlobOptions) (bool, error)

func (*MockStorageBlob) Name Uses

func (c *MockStorageBlob) Name() string

func (*MockStorageBlob) Properties Uses

func (c *MockStorageBlob) Properties() storage.BlobProperties

type MockStorageClient Uses

type MockStorageClient struct {
    testing.Stub
    Containers map[string]azurestorage.Container
}

func (*MockStorageClient) GetBlobService Uses

func (c *MockStorageClient) GetBlobService() azurestorage.BlobStorageClient

func (*MockStorageClient) GetContainerReference Uses

func (c *MockStorageClient) GetContainerReference(name string) azurestorage.Container

func (*MockStorageClient) NewClient Uses

func (c *MockStorageClient) NewClient(
    accountName, accountKey, blobServiceBaseURL, apiVersion string,
    useHTTPS bool,
) (azurestorage.Client, error)

NewClient exists to satisfy users who want a NewClientFunc.

type MockStorageContainer Uses

type MockStorageContainer struct {
    testing.Stub
    Blobs_ []azurestorage.Blob
}

func (*MockStorageContainer) Blob Uses

func (c *MockStorageContainer) Blob(name string) azurestorage.Blob

func (*MockStorageContainer) Blobs Uses

func (c *MockStorageContainer) Blobs() ([]azurestorage.Blob, error)

type Senders Uses

type Senders []autorest.Sender

Senders is a Sender that includes a collection of Senders, which will be called in sequence.

func (*Senders) Do Uses

func (s *Senders) Do(req *http.Request) (*http.Response, error)

type SerialSender Uses

type SerialSender struct {
    // contains filtered or unexported fields
}

SerialSender is a Sender that permits only one active Do call at a time.

func NewSerialSender Uses

func NewSerialSender(s autorest.Sender) *SerialSender

func (*SerialSender) Do Uses

func (s *SerialSender) Do(req *http.Request) (*http.Response, error)

Package azuretesting imports 16 packages (graph). Updated 2020-03-31. Refresh now. Tools for package owners.