-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
424 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package cyclinganalytics_test | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
"time" | ||
|
||
"github.com/bzimmer/activity/cyclinganalytics" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestUpload(t *testing.T) { | ||
tests := []struct { | ||
name, err string | ||
}{ | ||
{ | ||
name: "uploader error", | ||
err: "missing upload file", | ||
}, | ||
} | ||
|
||
for i := range tests { | ||
tt := tests[i] | ||
t.Run(tt.name, func(t *testing.T) { | ||
a := assert.New(t) | ||
mux := http.NewServeMux() | ||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | ||
}) | ||
|
||
svr := httptest.NewServer(mux) | ||
defer svr.Close() | ||
|
||
client, err := cyclinganalytics.NewClient( | ||
cyclinganalytics.WithBaseURL(svr.URL), | ||
cyclinganalytics.WithTokenCredentials("fooKey", "barToken", time.Time{})) | ||
a.NoError(err) | ||
uploader := client.Uploader() | ||
a.NotNil(uploader) | ||
upload, err := uploader.Upload(context.Background(), nil) | ||
if tt.err != "" { | ||
a.Error(err) | ||
a.Nil(upload) | ||
a.Contains(err.Error(), tt.err) | ||
return | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.