testing

package
v0.0.0-...-49972a8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: LGPL-2.1 Imports: 7 Imported by: 0

README

Unit Test

testing
  |__ identity
  |__ mocks
  |__ testcerts
  |__ interfaces.go
  |__ tools.go
  |__ var.go

Run test

$ cd ./testing/identity && go test

testcerts folder

Folder with fake certificates for mock up

  • testcert.go (to load test certificates found in the testcerts folder)

import (
	"github.com/kmilodenisglez/cc-identity-go/testcerts"
)

// load certificate with attributes for abac
certBytes, _ := testcerts.Certificates[3].CertBytes()

counterfeiter

Use counterfeiter to generate directives.

Counterfeiter allows you to simply generate test doubles for a given interface.

see https://github.com/maxbrunsfeld/counterfeiter

Behavior-Driven Development (BDD)

We use Ginkgo which enables the BDD. Paired with the Gomega matcher library.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CertByteRootCentralDC     []byte
	CertByteRootTecnomatica   []byte
	CertBase64RootTecnomatica = "" /* 5266-byte string literal not displayed */
	CertByteRoot              []byte
	CertByteUserWithAttrs     []byte
	CertByteClient            []byte
	CertByteAdmin             []byte
	CertByteAttrsExpired      []byte
	CertBytePeer0             []byte
	CertBase64Peer0           = "" /* 1416-byte string literal not displayed */
	CertByteUser2             []byte
	CertByteUserYisel         []byte
	CertBase64Yisel           = "" /* 2972-byte string literal not displayed */
	Timestamp                 = timestamppb.Now()
	MspID                     = "matcomMSP"
	ID1                       = "44b7b1c9-10bb-4a70-b290-aa403968247e"
	Did1                      = "did:fa3bdf5b4bcfac88ce9093ec3f0d58290f11c7ef6d2a683a7ee56746b333ec71"
	PublicKey                 = "" /* 126-byte string literal not displayed */
)

Functions

func CreateComposeKey

func CreateComposeKey(objectType string, keys []string) (string, error)

Dummy implementation to create compose key

func GomegaString

func GomegaString() string

func MarshalJSONOrPanic

func MarshalJSONOrPanic(v interface{}) []byte

func MarshalProtoOrPanic

func MarshalProtoOrPanic(pb proto.Message) []byte

MarshalProtoOrPanic is a helper for proto marshal.

func UnmarshalJSONOrPanic

func UnmarshalJSONOrPanic(data []byte, v interface{}) interface{}

Types

This section is empty.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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