Skip to content

Commit 8769235

Browse files
authored
Merge branch 'main' into bugfix/utility-updates
2 parents 2e8eb1c + df96efa commit 8769235

File tree

23 files changed

+46
-416
lines changed

23 files changed

+46
-416
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ The CLI currently supports the following products:
5757

5858
- [api](./docs/api.md)
5959
- [configure](./docs/configure.md)
60-
- [drops](./docs/drops.md)
6160
- [event](docs/event.md)
6261
- [token](docs/token.md)
6362
- [version](docs/version.md)

cmd/drops.go

-41
This file was deleted.

docs/drops.md

-32
This file was deleted.

internal/api/api_test.go

+26-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package api
55
import (
66
"net/http"
77
"net/http/httptest"
8+
"strings"
89
"testing"
910
"time"
1011

@@ -29,6 +30,19 @@ func TestNewRequest(t *testing.T) {
2930
a.Equal(params.ClientID, r.Header.Get("Client-ID"), "ClientID mismatch")
3031
a.Equal("Bearer "+params.Token, r.Header.Get("Authorization"), "Token mismatch")
3132

33+
if r.URL.Path == "/error" {
34+
w.WriteHeader(http.StatusInternalServerError)
35+
} else if r.URL.Path == "/nocontent" {
36+
w.WriteHeader(http.StatusNoContent)
37+
return
38+
} else if r.URL.Path == "/cursor" {
39+
if strings.Contains(r.URL.RawQuery, "after") {
40+
w.Write([]byte("{}"))
41+
return
42+
}
43+
w.Write([]byte("{\"data\":[],\"pagination\":{\"cursor\":\"test\"}}"))
44+
return
45+
}
3246
w.Write([]byte("{}"))
3347
}))
3448
defer ts.Close()
@@ -39,8 +53,18 @@ func TestNewRequest(t *testing.T) {
3953
viper.Set("accesstoken", "4567")
4054
viper.Set("refreshtoken", "123")
4155

42-
NewRequest("POST", "", []string{"test=1", "test=2"}, nil, true, false)
43-
NewRequest("POST", "", []string{"test=1", "test=2"}, nil, false, true)
56+
// tests for normal get requests
57+
NewRequest("GET", "", []string{"test=1", "test=2"}, nil, true, false)
58+
NewRequest("GET", "", []string{"test=1", "test=2"}, nil, false, true)
59+
60+
// testing cursors autopagination
61+
NewRequest("GET", "/cursor", []string{"test=1", "test=2"}, nil, false, true)
62+
63+
// testing 204 no-content apis
64+
NewRequest("POST", "/nocontent", []string{"test=1", "test=2"}, nil, false, false)
65+
66+
// testing 500 errors
67+
NewRequest("GET", "/error", []string{"test=1", "test=2"}, nil, false, true)
4468
}
4569

4670
func TestValidOptions(t *testing.T) {

internal/drops/client.go

-39
This file was deleted.

internal/drops/client_test.go

-43
This file was deleted.

internal/drops/exporter.go

-167
This file was deleted.

0 commit comments

Comments
 (0)