Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
76c233f2
Unverified
Commit
76c233f2
authored
Jun 07, 2019
by
Massimiliano Pippi
Committed by
GitHub
Jun 07, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #229 from arduino/massi/test
Introduce new testing layout
parents
10a0cdd3
c5887eef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
5 deletions
+36
-5
Taskfile.yml
Taskfile.yml
+23
-0
auth/auth_test.go
auth/auth_test.go
+13
-5
No files found.
Taskfile.yml
0 → 100644
View file @
76c233f2
version
:
'
2'
tasks
:
build
:
desc
:
Build the project
cmds
:
-
go build -v -i
test
:
desc
:
Run the full testsuite
cmds
:
-
task
:
test-unit
-
task
:
test-integration
test-unit
:
desc
:
Run unit tests only
cmds
:
-
go test -short {{ default "-v" .GOFLAGS }} {{ default "./..." .TARGETS }}
test-integration
:
desc
:
Run integration tests only
cmds
:
-
go test -run Integration {{ default "-v" .GOFLAGS }} {{ default "./..." .TARGETS }}
auth/auth_test.go
View file @
76c233f2
...
@@ -19,13 +19,13 @@ package auth_test
...
@@ -19,13 +19,13 @@ package auth_test
import
(
import
(
"encoding/json"
"encoding/json"
"flag"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
"os"
"os"
"testing"
"testing"
"github.com/arduino/arduino-cli/auth"
"github.com/arduino/arduino-cli/auth"
"github.com/stretchr/testify/require"
)
)
var
(
var
(
...
@@ -33,12 +33,20 @@ var (
...
@@ -33,12 +33,20 @@ var (
testPass
=
os
.
Getenv
(
"TEST_PASSWORD"
)
testPass
=
os
.
Getenv
(
"TEST_PASSWORD"
)
)
)
func
TestMain
(
m
*
testing
.
M
)
{
func
TestNewConfig
(
t
*
testing
.
T
)
{
flag
.
Parse
()
conf
:=
auth
.
New
()
os
.
Exit
(
m
.
Run
())
require
.
Equal
(
t
,
"https://hydra.arduino.cc/oauth2/auth"
,
conf
.
CodeURL
)
require
.
Equal
(
t
,
"https://hydra.arduino.cc/oauth2/token"
,
conf
.
TokenURL
)
require
.
Equal
(
t
,
"cli"
,
conf
.
ClientID
)
require
.
Equal
(
t
,
"http://localhost:5000"
,
conf
.
RedirectURI
)
require
.
Equal
(
t
,
"profile:core offline"
,
conf
.
Scopes
)
}
}
func
TestToken
(
t
*
testing
.
T
)
{
func
TestTokenIntegration
(
t
*
testing
.
T
)
{
if
testing
.
Short
()
{
t
.
Skip
(
"skip integration test"
)
}
if
testUser
==
""
||
testPass
==
""
{
if
testUser
==
""
||
testPass
==
""
{
t
.
Skip
(
"Skipped because user and pass were not provided"
)
t
.
Skip
(
"Skipped because user and pass were not provided"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment