Skip to content

Commit b575336

Browse files
chore: add request options to client tests (#60)
1 parent 2d3d9e7 commit b575336

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

client_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func (t *closureTransport) RoundTrip(req *http.Request) (*http.Response, error)
2626
func TestUserAgentHeader(t *testing.T) {
2727
var userAgent string
2828
client := gitpod.NewClient(
29+
option.WithBearerToken("My Bearer Token"),
2930
option.WithHTTPClient(&http.Client{
3031
Transport: &closureTransport{
3132
fn: func(req *http.Request) (*http.Response, error) {
@@ -46,6 +47,7 @@ func TestUserAgentHeader(t *testing.T) {
4647
func TestRetryAfter(t *testing.T) {
4748
retryCountHeaders := make([]string, 0)
4849
client := gitpod.NewClient(
50+
option.WithBearerToken("My Bearer Token"),
4951
option.WithHTTPClient(&http.Client{
5052
Transport: &closureTransport{
5153
fn: func(req *http.Request) (*http.Response, error) {
@@ -79,6 +81,7 @@ func TestRetryAfter(t *testing.T) {
7981
func TestDeleteRetryCountHeader(t *testing.T) {
8082
retryCountHeaders := make([]string, 0)
8183
client := gitpod.NewClient(
84+
option.WithBearerToken("My Bearer Token"),
8285
option.WithHTTPClient(&http.Client{
8386
Transport: &closureTransport{
8487
fn: func(req *http.Request) (*http.Response, error) {
@@ -108,6 +111,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
108111
func TestOverwriteRetryCountHeader(t *testing.T) {
109112
retryCountHeaders := make([]string, 0)
110113
client := gitpod.NewClient(
114+
option.WithBearerToken("My Bearer Token"),
111115
option.WithHTTPClient(&http.Client{
112116
Transport: &closureTransport{
113117
fn: func(req *http.Request) (*http.Response, error) {
@@ -137,6 +141,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
137141
func TestRetryAfterMs(t *testing.T) {
138142
attempts := 0
139143
client := gitpod.NewClient(
144+
option.WithBearerToken("My Bearer Token"),
140145
option.WithHTTPClient(&http.Client{
141146
Transport: &closureTransport{
142147
fn: func(req *http.Request) (*http.Response, error) {
@@ -162,6 +167,7 @@ func TestRetryAfterMs(t *testing.T) {
162167

163168
func TestContextCancel(t *testing.T) {
164169
client := gitpod.NewClient(
170+
option.WithBearerToken("My Bearer Token"),
165171
option.WithHTTPClient(&http.Client{
166172
Transport: &closureTransport{
167173
fn: func(req *http.Request) (*http.Response, error) {
@@ -181,6 +187,7 @@ func TestContextCancel(t *testing.T) {
181187

182188
func TestContextCancelDelay(t *testing.T) {
183189
client := gitpod.NewClient(
190+
option.WithBearerToken("My Bearer Token"),
184191
option.WithHTTPClient(&http.Client{
185192
Transport: &closureTransport{
186193
fn: func(req *http.Request) (*http.Response, error) {
@@ -208,6 +215,7 @@ func TestContextDeadline(t *testing.T) {
208215

209216
go func() {
210217
client := gitpod.NewClient(
218+
option.WithBearerToken("My Bearer Token"),
211219
option.WithHTTPClient(&http.Client{
212220
Transport: &closureTransport{
213221
fn: func(req *http.Request) (*http.Response, error) {

0 commit comments

Comments
 (0)