test

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 38 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CertIdentity = "00000000-0000-0000-0000-000000000001"

	MfgCert = []byte(`-----BEGIN CERTIFICATE-----
MIIB9zCCAZygAwIBAgIRAOwIWPAt19w7DswoszkVIEIwCgYIKoZIzj0EAwIwEzER
MA8GA1UEChMIVGVzdCBPUkcwHhcNMTkwNTAyMjAwNjQ4WhcNMjkwMzEwMjAwNjQ4
WjBHMREwDwYDVQQKEwhUZXN0IE9SRzEyMDAGA1UEAxMpdXVpZDpiNWEyYTQyZS1i
Mjg1LTQyZjEtYTM2Yi0wMzRjOGZjOGVmZDUwWTATBgcqhkjOPQIBBggqhkjOPQMB
BwNCAAQS4eiM0HNPROaiAknAOW08mpCKDQmpMUkywdcNKoJv1qnEedBhWne7Z0jq
zSYQbyqyIVGujnI3K7C63NRbQOXQo4GcMIGZMA4GA1UdDwEB/wQEAwIDiDAzBgNV
HSUELDAqBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMBBgorBgEEAYLefAEG
MAwGA1UdEwEB/wQCMAAwRAYDVR0RBD0wO4IJbG9jYWxob3N0hwQAAAAAhwR/AAAB
hxAAAAAAAAAAAAAAAAAAAAAAhxAAAAAAAAAAAAAAAAAAAAABMAoGCCqGSM49BAMC
A0kAMEYCIQDuhl6zj6gl2YZbBzh7Th0uu5izdISuU/ESG+vHrEp7xwIhANCA7tSt
aBlce+W76mTIhwMFXQfyF3awWIGjOcfTV8pU
-----END CERTIFICATE-----
`)

	MfgKey = []byte(`-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIMPeADszZajrkEy4YvACwcbR0pSdlKG+m8ALJ6lj/ykdoAoGCCqGSM49
AwEHoUQDQgAEEuHojNBzT0TmogJJwDltPJqQig0JqTFJMsHXDSqCb9apxHnQYVp3
u2dI6s0mEG8qsiFRro5yNyuwutzUW0Dl0A==
-----END EC PRIVATE KEY-----
`)

	MfgTrustedCA = []byte(`-----BEGIN CERTIFICATE-----
MIIBaTCCAQ+gAwIBAgIQR33gIB75I7Vi/QnMnmiWvzAKBggqhkjOPQQDAjATMREw
DwYDVQQKEwhUZXN0IE9SRzAeFw0xOTA1MDIyMDA1MTVaFw0yOTAzMTAyMDA1MTVa
MBMxETAPBgNVBAoTCFRlc3QgT1JHMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
xbwMaS8jcuibSYJkCmuVHfeV3xfYVyUq8Iroz7YlXaTayspW3K4hVdwIsy/5U+3U
vM/vdK5wn2+NrWy45vFAJqNFMEMwDgYDVR0PAQH/BAQDAgEGMBMGA1UdJQQMMAoG
CCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0RBAQwAoIAMAoGCCqGSM49
BAMCA0gAMEUCIBWkxuHKgLSp6OXDJoztPP7/P5VBZiwLbfjTCVRxBvwWAiEAnzNu
6gKPwtKmY0pBxwCo3NNmzNpA6KrEOXE56PkiQYQ=
-----END CERTIFICATE-----
`)
	MfgTrustedCAKey = []byte(`-----BEGIN EC PRIVATE KEY-----
MHcCAQEEICzfC16AqtSv3wt+qIbrgM8dTqBhHANJhZS5xCpH6P2roAoGCCqGSM49
AwEHoUQDQgAExbwMaS8jcuibSYJkCmuVHfeV3xfYVyUq8Iroz7YlXaTayspW3K4h
VdwIsy/5U+3UvM/vdK5wn2+NrWy45vFAJg==
-----END EC PRIVATE KEY-----
`)
)
View Source
var (
	TestDeviceName string

	TestDevsimResources        []schema.ResourceLink
	TestDevsimBackendResources []schema.ResourceLink
)

Functions

func ClearDB

func ClearDB(ctx context.Context, t *testing.T)

func DecodeCbor

func DecodeCbor(t *testing.T, data []byte) interface{}

func DoHTTPRequest

func DoHTTPRequest(t *testing.T, req *http.Request) *http.Response

func EncodeToCbor

func EncodeToCbor(t *testing.T, v interface{}) []byte

func FindDeviceByName

func FindDeviceByName(ctx context.Context, name string) (deviceID string, _ error)
func FindResourceLink(href string) schema.ResourceLink
func GetAllBackendResourceLinks() []schema.ResourceLink

func GetRootCertificateAuthorities

func GetRootCertificateAuthorities(t *testing.T) []*x509.Certificate

func GetRootCertificatePool

func GetRootCertificatePool(t *testing.T) *x509.CertPool

func MustFindDeviceByName

func MustFindDeviceByName(name string) (deviceID string)

func MustGetHostname

func MustGetHostname() string

func NewSDKClient

func NewSDKClient() (*local.Client, error)

func OnboardDevSim

func OnboardDevSim(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, deviceID string, gwHost string, expectedResources []schema.ResourceLink) (string, func())

func ResourceLinkToPublishEvent

func ResourceLinkToPublishEvent(deviceID string, instanceID int64, links []schema.ResourceLink) *pb.Event

func ResourceLinkToResourceChangedEvent

func ResourceLinkToResourceChangedEvent(deviceID string, l schema.ResourceLink) *pb.Event

func ResourceLinksToExpectedResourceChangedEvents

func ResourceLinksToExpectedResourceChangedEvents(deviceID string, links []schema.ResourceLink) map[string]*pb.Event

func ResourceLinksToPb

func ResourceLinksToPb(deviceID string, s []schema.ResourceLink) []*pb.ResourceLink

func SetUp

func SetUp(ctx context.Context, t *testing.T) (TearDown func())

func SortResources

func SortResources(s []*pb.ResourceLink) []*pb.ResourceLink

Types

type HTTPRequestBuilder

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

func NewHTTPRequest

func NewHTTPRequest(method, url string, body io.Reader) *HTTPRequestBuilder

func (*HTTPRequestBuilder) AddHeader

func (c *HTTPRequestBuilder) AddHeader(key, value string) *HTTPRequestBuilder

func (*HTTPRequestBuilder) AddQuery

func (c *HTTPRequestBuilder) AddQuery(key, value string) *HTTPRequestBuilder

func (*HTTPRequestBuilder) AuthToken

func (c *HTTPRequestBuilder) AuthToken(token string) *HTTPRequestBuilder

func (*HTTPRequestBuilder) Build

func (c *HTTPRequestBuilder) Build(ctx context.Context, t *testing.T) *http.Request

type SortResourcesByHref

type SortResourcesByHref []*pb.ResourceLink

func (SortResourcesByHref) Len

func (a SortResourcesByHref) Len() int

func (SortResourcesByHref) Less

func (a SortResourcesByHref) Less(i, j int) bool

func (SortResourcesByHref) Swap

func (a SortResourcesByHref) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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