resourcetesting

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

This package provides helpers for testing with resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCharmResource

func NewCharmResource(c *gc.C, name, content string) charmresource.Resource

NewCharmResource produces basic resource info for the given name and content. The origin is set set to "upload".

func NewPlaceholderResource

func NewPlaceholderResource(c *gc.C, name, applicationID string) resource.Resource

NewPlaceholderResource returns resource info for a resource that has not been uploaded or pulled from the charm store yet. The origin is set to "upload".

func NewResource

func NewResource(c *gc.C, stub *testing.Stub, name, applicationID, content string) resource.Opened

NewResource produces full resource info for the given name and content. The origin is set set to "upload". A reader is also returned which contains the content.

Types

type StubUnit

type StubUnit struct {
	*testing.Stub

	ReturnName            string
	ReturnApplicationName string
	ReturnCharmURL        *charm.URL
}

StubUnit is a testing implementation of resource.Unit.

func (*StubUnit) ApplicationName

func (s *StubUnit) ApplicationName() string

ApplicationName implements resource.Unit.

func (*StubUnit) CharmURL

func (s *StubUnit) CharmURL() (*charm.URL, bool)

CharmURL implements resource.Unit.

func (*StubUnit) Name

func (s *StubUnit) Name() string

Name implements resource.Unit.

Jump to

Keyboard shortcuts

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