Documentation
¶
Index ¶
- Constants
- Variables
- func CheckGoldenFramer(t *testing.T, name string, f dfutil.Framer)
- func EnsureKeyIsSet(t *testing.T, m map[string]interface{}, key string)
- func EnsureKeysAreSet(t *testing.T, m map[string]interface{}, keys ...string)
- func EnsureTypeEquality(t *testing.T, actual interface{}, expected interface{})
- func GetTestQueryFunction(expected interface{}) func(*testing.T, interface{})
- func GetTestVariablesFunction(keys ...string) func(*testing.T, map[string]interface{})
- func TypesAreEqual(a interface{}, b interface{}) bool
- type TestClient
- func (c *TestClient) GetWorkflowUsage(ctx context.Context, owner, repo, workflow string, timeRange backend.TimeRange) (models.WorkflowUsage, error)
- func (c *TestClient) ListWorkflows(ctx context.Context, owner, repo string, opts *googlegithub.ListOptions) (*googlegithub.Workflows, *googlegithub.Response, error)
- func (c *TestClient) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error
Constants ¶
const UpdateGoldenFiles bool = true
UpdateGoldenFiles defines whether or not to update the files locally after checking the responses for validity
Variables ¶
var ( // ErrTNil is returned by TestClient.Query(...) if the `testing.T` pointer in the TestClient is nil ErrTNil = errors.New("t is nil") )
Functions ¶
func CheckGoldenFramer ¶
CheckGoldenFramer checks the GoldenDataResponse and creates a standard file format for saving them
func EnsureKeyIsSet ¶
EnsureKeyIsSet ensures that a single key is set in the map (m)
func EnsureKeysAreSet ¶
EnsureKeysAreSet ensures that all of the provided keys are set in the map (m)
func EnsureTypeEquality ¶
EnsureTypeEquality uses the test object and fails the test if the types are not equal
func GetTestQueryFunction ¶
GetTestQueryFunction returns a function that satisfies the TestQuery function in the TestClient object
func GetTestVariablesFunction ¶
GetTestVariablesFunction provides a function that satisfies the TestVariables function of a TestClient
func TypesAreEqual ¶
func TypesAreEqual(a interface{}, b interface{}) bool
TypesAreEqual compares the types a and b. If they are not equal, then false is returned. If they are equal, then true is returned.
Types ¶
type TestClient ¶
type TestClient struct { T *testing.T // TestVariables can be used TestVariables func(t *testing.T, variables map[string]interface{}) TestQuery func(t *testing.T, q interface{}) }
The TestClient satisfies the Client interface and implements the query function
func NewTestClient ¶
func NewTestClient(t *testing.T, testVariables func(t *testing.T, variables map[string]interface{}), testQuery func(t *testing.T, q interface{}), ) *TestClient
NewTestClient creates a new TestClient
func (*TestClient) GetWorkflowUsage ¶ added in v1.4.7
func (c *TestClient) GetWorkflowUsage(ctx context.Context, owner, repo, workflow string, timeRange backend.TimeRange) (models.WorkflowUsage, error)
GetWorkflowUsage is not implemented because it is not being used at the moment.
func (*TestClient) ListWorkflows ¶ added in v1.4.7
func (c *TestClient) ListWorkflows(ctx context.Context, owner, repo string, opts *googlegithub.ListOptions) (*googlegithub.Workflows, *googlegithub.Response, error)
ListWorkflows is not implemented because it is not being used at the moment.