Replaces goyaml With gopkg.in/yaml.v1 in Unit Test Packages
This commit is contained in:
parent
316548899f
commit
12fae4b62e
7 changed files with 16 additions and 19 deletions
|
@ -2,7 +2,6 @@ package commit
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -153,8 +152,8 @@ func TestInsert(t *testing.T) {
|
|||
|
||||
// verify unique remote + remote id constraint
|
||||
err = commits.Insert(&Commit{RepoID: 3, Branch: "bar", Sha: "85f8c029b902ed9400bc600bac301a0aadb144ac"})
|
||||
if err == nil || !strings.Contains(err.Error(), "commit_sha, commit_branch, repo_id are not unique") {
|
||||
t.Errorf("Want unique constraint violated, got %s", err)
|
||||
if err == nil {
|
||||
t.Error("Want unique constraint violated")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package repo
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/server/database"
|
||||
|
@ -81,8 +80,8 @@ func TestInsert(t *testing.T) {
|
|||
|
||||
// verify unique remote + owner + name login constraint
|
||||
var err = repos.Insert(&Repo{Host: repo.Host, Owner: repo.Owner, Name: repo.Name})
|
||||
if err == nil || !strings.Contains(err.Error(), "repo_host, repo_owner, repo_name are not unique") {
|
||||
t.Errorf("Want unique constraint violated, got %s", err)
|
||||
if err == nil {
|
||||
t.Error("Want unique constraint violated")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package user
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/server/database"
|
||||
|
@ -99,14 +98,14 @@ func TestInsert(t *testing.T) {
|
|||
|
||||
// verify unique remote + remote login constraint
|
||||
var err = users.Insert(&User{Remote: user.Remote, Login: user.Login, Token: "f71eb4a81a2cca56035dd7f6f2942e41"})
|
||||
if err == nil || !strings.Contains(err.Error(), "user_remote, user_login are not unique") {
|
||||
t.Errorf("Want Token unique constraint violated, got %s", err)
|
||||
if err == nil {
|
||||
t.Error("Want Token unique constraint violated")
|
||||
}
|
||||
|
||||
// verify unique token constraint
|
||||
err = users.Insert(&User{Remote: "gitlab.com", Login: user.Login, Token: user.Token})
|
||||
if err == nil || !strings.Contains(err.Error(), "user_token is not unique") {
|
||||
t.Errorf("Want Token unique constraint violated, got %s", err)
|
||||
if err == nil {
|
||||
t.Error("Want Token unique constraint violated")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/drone/drone/shared/build/buildfile"
|
||||
|
||||
"launchpad.net/goyaml"
|
||||
"gopkg.in/yaml.v1"
|
||||
)
|
||||
|
||||
// emulate Build struct
|
||||
|
@ -39,7 +39,7 @@ deploy:
|
|||
|
||||
func setUpWithBash(input string) (string, error) {
|
||||
var buildStruct buildWithBash
|
||||
err := goyaml.Unmarshal([]byte(input), &buildStruct)
|
||||
err := yaml.Unmarshal([]byte(input), &buildStruct)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/drone/drone/shared/build/buildfile"
|
||||
|
||||
"launchpad.net/goyaml"
|
||||
"gopkg.in/yaml.v1"
|
||||
)
|
||||
|
||||
// emulate Build struct
|
||||
|
@ -52,7 +52,7 @@ deploy:
|
|||
|
||||
func setUpWithCF(input string) (string, error) {
|
||||
var buildStruct DeployToCF
|
||||
err := goyaml.Unmarshal([]byte(input), &buildStruct)
|
||||
err := yaml.Unmarshal([]byte(input), &buildStruct)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/drone/drone/shared/build/buildfile"
|
||||
|
||||
"launchpad.net/goyaml"
|
||||
"gopkg.in/yaml.v1"
|
||||
)
|
||||
|
||||
// emulate Build struct
|
||||
|
@ -51,7 +51,7 @@ deploy:
|
|||
|
||||
func setUp(input string) (string, error) {
|
||||
var buildStruct build
|
||||
err := goyaml.Unmarshal([]byte(input), &buildStruct)
|
||||
err := yaml.Unmarshal([]byte(input), &buildStruct)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/drone/drone/shared/build/buildfile"
|
||||
|
||||
"launchpad.net/goyaml"
|
||||
"gopkg.in/yaml.v1"
|
||||
)
|
||||
|
||||
// emulate Build struct
|
||||
|
@ -44,7 +44,7 @@ publish:
|
|||
|
||||
func setUpWithNPM(input string) (string, error) {
|
||||
var buildStruct PublishToNPM
|
||||
err := goyaml.Unmarshal([]byte(input), &buildStruct)
|
||||
err := yaml.Unmarshal([]byte(input), &buildStruct)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue