File tree Expand file tree Collapse file tree 2 files changed +36
-5
lines changed Expand file tree Collapse file tree 2 files changed +36
-5
lines changed Original file line number Diff line number Diff line change 1+ version : ' 2'
2+
3+ tasks :
4+ build :
5+ desc : Build the project
6+ cmds :
7+ - go build -v -i
8+
9+ test :
10+ desc : Run the full testsuite
11+ cmds :
12+ - task : test-unit
13+ - task : test-integration
14+
15+ test-unit :
16+ desc : Run unit tests only
17+ cmds :
18+ - go test -short {{ default "-v" .GOFLAGS }} {{ default "./..." .TARGETS }}
19+
20+ test-integration :
21+ desc : Run integration tests only
22+ cmds :
23+ - go test -run Integration {{ default "-v" .GOFLAGS }} {{ default "./..." .TARGETS }}
Original file line number Diff line number Diff line change @@ -19,26 +19,34 @@ package auth_test
1919
2020import (
2121 "encoding/json"
22- "flag"
2322 "io/ioutil"
2423 "net/http"
2524 "os"
2625 "testing"
2726
2827 "github.com/arduino/arduino-cli/auth"
28+ "github.com/stretchr/testify/require"
2929)
3030
3131var (
3232 testUser = os .Getenv ("TEST_USERNAME" )
3333 testPass = os .Getenv ("TEST_PASSWORD" )
3434)
3535
36- func TestMain (m * testing.M ) {
37- flag .Parse ()
38- os .Exit (m .Run ())
36+ func TestNewConfig (t * testing.T ) {
37+ conf := auth .New ()
38+ require .Equal (t , "https://hydra.arduino.cc/oauth2/auth" , conf .CodeURL )
39+ require .Equal (t , "https://hydra.arduino.cc/oauth2/token" , conf .TokenURL )
40+ require .Equal (t , "cli" , conf .ClientID )
41+ require .Equal (t , "http://localhost:5000" , conf .RedirectURI )
42+ require .Equal (t , "profile:core offline" , conf .Scopes )
3943}
4044
41- func TestToken (t * testing.T ) {
45+ func TestTokenIntegration (t * testing.T ) {
46+ if testing .Short () {
47+ t .Skip ("skip integration test" )
48+ }
49+
4250 if testUser == "" || testPass == "" {
4351 t .Skip ("Skipped because user and pass were not provided" )
4452 }
You can’t perform that action at this time.
0 commit comments