Skip to content

capitalized client in Query#16

Open
thomaswhitcomb wants to merge 2 commits into
spaceapegames:masterfrom
thomaswhitcomb:open-query-for-unit-testing
Open

capitalized client in Query#16
thomaswhitcomb wants to merge 2 commits into
spaceapegames:masterfrom
thomaswhitcomb:open-query-for-unit-testing

Conversation

@thomaswhitcomb

Copy link
Copy Markdown

No description provided.

@louism517

Copy link
Copy Markdown
Contributor

Thanks for this @thomaswhitcomb

Would you mind explaining your reasoning here? I'm loath to capitalise the Client in the Query struct without good reason, as it then differs from all of the other structs in the project.

If you need to inject a mocked Wavefronter into a Query object you can just instantiate it without using NewQuery, e.g.:

q := &Query{
		Params: NewQueryParams(query),
		client: &MockWavefrontClient{
		    Response: []byte(`{"valid":"json"}`),
		    Client: Client{
				Config:     &Config{Token: "1234-5678-9977"},
				BaseURL:    baseurl,
				httpClient: http.DefaultClient,
				debug:      true,
			},
		},
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants