mirror of
https://github.com/sstent/go-garminconnect.git
synced 2026-02-01 20:11:44 +00:00
garth more done - stuck on tests
This commit is contained in:
@@ -14,6 +14,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// mockAuthImpl implements the Authenticator interface for tests
|
||||
type mockAuthImpl struct{}
|
||||
|
||||
func (m *mockAuthImpl) RefreshToken(_, _ string) (string, error) {
|
||||
return "refreshed-token", nil
|
||||
}
|
||||
|
||||
func TestGearService(t *testing.T) {
|
||||
// Create test server
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -75,7 +82,9 @@ func TestGearService(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create client
|
||||
client, err := NewClient(session, "")
|
||||
// Create mock authenticator for tests
|
||||
mockAuth := &mockAuthImpl{}
|
||||
client, err := NewClient(mockAuth, session, "")
|
||||
assert.NoError(t, err)
|
||||
client.HTTPClient.SetBaseURL(srv.URL)
|
||||
|
||||
@@ -93,7 +102,9 @@ func TestGearService(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create client
|
||||
client, err := NewClient(session, "")
|
||||
// Create mock authenticator for tests
|
||||
mockAuth := &mockAuthImpl{}
|
||||
client, err := NewClient(mockAuth, session, "")
|
||||
assert.NoError(t, err)
|
||||
client.HTTPClient.SetBaseURL(srv.URL)
|
||||
|
||||
@@ -111,7 +122,9 @@ func TestGearService(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create client
|
||||
client, err := NewClient(session, "")
|
||||
// Create mock authenticator for tests
|
||||
mockAuth := &mockAuthImpl{}
|
||||
client, err := NewClient(mockAuth, session, "")
|
||||
assert.NoError(t, err)
|
||||
client.HTTPClient.SetBaseURL(srv.URL)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user