Skip to content

Commit

Permalink
Remove TestRefresh from efactura subpackage
Browse files Browse the repository at this point in the history
  • Loading branch information
printesoi committed Oct 19, 2024
1 parent f2b23fa commit 083bc4a
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions pkg/efactura/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import (
"errors"
"fmt"
"os"
"testing"

xoauth2 "golang.org/x/oauth2"

"github.com/printesoi/e-factura-go/pkg/oauth2"
"github.com/stretchr/testify/assert"
)

func getTestCIF() string {
Expand Down Expand Up @@ -101,36 +99,3 @@ func setupRealClient(skipIfEmptyEnv bool, oauth2Cfg *oauth2.Config) (*Client, er
client, err := NewSandboxClient(ctx, oauth2Cfg.TokenSourceWithChangedHandler(ctx, token, onTokenChanged))
return client, err
}

func TestRefresh(t *testing.T) {
assert := assert.New(t)

oauth2Cfg, err := setupTestEnvOAuth2Config(false)
if !assert.NoError(err) {
return
}

tokenJSON := os.Getenv("EFACTURA_TEST_INITIAL_TOKEN_JSON")
if tokenJSON == "" {
assert.FailNow("Invalid initial token json")
return
}

token, err := oauth2.TokenFromJSON([]byte(tokenJSON))
if err != nil {
assert.FailNow("Invalid initial token json", err)
}

tr := oauth2Cfg.TokenRefresher(context.Background(), token, nil)
if tr != nil {
tok, err := tr.Token()
if !assert.NoError(err) {
return
}
tj, err := json.Marshal(tok)
if !assert.NoError(err) {
return
}
fmt.Printf("%s\n", string(tj))
}
}

0 comments on commit 083bc4a

Please sign in to comment.