fixed unit tests that were using now removed config

This commit is contained in:
Brad Rydzewski 2015-09-08 19:09:40 -07:00
parent af82f7aa2c
commit ba47948fc9
2 changed files with 11 additions and 19 deletions

View file

@ -5,7 +5,6 @@ import (
"net/http"
"net/rpc"
"github.com/drone/drone/pkg/config"
common "github.com/drone/drone/pkg/types"
)
@ -18,14 +17,15 @@ type Client struct {
// New returns a new, remote datastore backend that connects
// via tcp and exchanges data using Go's RPC mechanism.
func New(conf *config.Config) (*Client, error) {
conn, err := net.Dial("tcp", conf.Server.Addr)
if err != nil {
return nil, err
}
client := &Client{
rpc.NewClient(conn),
}
return client, nil
// conn, err := net.Dial("tcp", conf.Server.Addr)
// if err != nil {
// return nil, err
// }
// client := &Client{
// rpc.NewClient(conn),
// }
// return client, nil
return nil, nil
}
func (c *Client) Login(token, secret string) (*common.User, error) {

View file

@ -12,7 +12,6 @@ import (
. "github.com/drone/drone/Godeps/_workspace/src/github.com/franela/goblin"
"github.com/drone/drone/Godeps/_workspace/src/github.com/gin-gonic/gin"
"github.com/drone/drone/Godeps/_workspace/src/github.com/stretchr/testify/mock"
"github.com/drone/drone/pkg/config"
"github.com/drone/drone/pkg/server/recorder"
"github.com/drone/drone/pkg/server/session"
"github.com/drone/drone/pkg/store/mock"
@ -60,10 +59,7 @@ func TestToken(t *testing.T) {
ctx.Set("datastore", store)
ctx.Set("user", &types.User{Login: "Freya"})
conf := &config.Config{}
conf.Session.Secret = "Otto"
ctx.Set("settings", conf)
ctx.Set("session", session.New(conf.Session.Secret))
ctx.Set("session", session.New("Otto"))
// prepare the mock
store.On("AddToken", mock.AnythingOfType("*types.Token")).Return(test.storeErr).Once()
@ -98,11 +94,7 @@ func TestToken(t *testing.T) {
ctx.Set("datastore", store)
ctx.Set("user", &types.User{Login: "Freya"})
conf := &config.Config{}
conf.Session.Secret = "Otto"
ctx.Set("settings", conf)
ctx.Set("session", session.New(conf.Session.Secret))
ctx.Set("session", session.New("Otto"))
// prepare the mock
store.On("TokenLabel", mock.AnythingOfType("*types.User"), test.inLabel).Return(test.outToken, test.errTokenLabel).Once()