Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/utility-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lleadbet committed Apr 14, 2021
2 parents 2e8eb1c + df96efa commit 8769235
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 416 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ The CLI currently supports the following products:

- [api](./docs/api.md)
- [configure](./docs/configure.md)
- [drops](./docs/drops.md)
- [event](docs/event.md)
- [token](docs/token.md)
- [version](docs/version.md)
Expand Down
41 changes: 0 additions & 41 deletions cmd/drops.go

This file was deleted.

32 changes: 0 additions & 32 deletions docs/drops.md

This file was deleted.

28 changes: 26 additions & 2 deletions internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package api
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"

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

if r.URL.Path == "/error" {
w.WriteHeader(http.StatusInternalServerError)
} else if r.URL.Path == "/nocontent" {
w.WriteHeader(http.StatusNoContent)
return
} else if r.URL.Path == "/cursor" {
if strings.Contains(r.URL.RawQuery, "after") {
w.Write([]byte("{}"))
return
}
w.Write([]byte("{\"data\":[],\"pagination\":{\"cursor\":\"test\"}}"))
return
}
w.Write([]byte("{}"))
}))
defer ts.Close()
Expand All @@ -39,8 +53,18 @@ func TestNewRequest(t *testing.T) {
viper.Set("accesstoken", "4567")
viper.Set("refreshtoken", "123")

NewRequest("POST", "", []string{"test=1", "test=2"}, nil, true, false)
NewRequest("POST", "", []string{"test=1", "test=2"}, nil, false, true)
// tests for normal get requests
NewRequest("GET", "", []string{"test=1", "test=2"}, nil, true, false)
NewRequest("GET", "", []string{"test=1", "test=2"}, nil, false, true)

// testing cursors autopagination
NewRequest("GET", "/cursor", []string{"test=1", "test=2"}, nil, false, true)

// testing 204 no-content apis
NewRequest("POST", "/nocontent", []string{"test=1", "test=2"}, nil, false, false)

// testing 500 errors
NewRequest("GET", "/error", []string{"test=1", "test=2"}, nil, false, true)
}

func TestValidOptions(t *testing.T) {
Expand Down
39 changes: 0 additions & 39 deletions internal/drops/client.go

This file was deleted.

43 changes: 0 additions & 43 deletions internal/drops/client_test.go

This file was deleted.

167 changes: 0 additions & 167 deletions internal/drops/exporter.go

This file was deleted.

0 comments on commit 8769235

Please sign in to comment.