fix unit tests
This commit is contained in:
@@ -13,11 +13,10 @@ import (
|
|||||||
mgrpcc "github.com/asim/go-micro/plugins/client/grpc/v4"
|
mgrpcc "github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||||
empty "github.com/golang/protobuf/ptypes/empty"
|
empty "github.com/golang/protobuf/ptypes/empty"
|
||||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||||
|
"github.com/owncloud/ocis/accounts/pkg/logging"
|
||||||
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||||
svc "github.com/owncloud/ocis/accounts/pkg/service/v0"
|
svc "github.com/owncloud/ocis/accounts/pkg/service/v0"
|
||||||
oclog "github.com/owncloud/ocis/ocis-pkg/log"
|
|
||||||
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
|
||||||
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"go-micro.dev/v4/client"
|
"go-micro.dev/v4/client"
|
||||||
@@ -83,10 +82,17 @@ func init() {
|
|||||||
cfg.Repo.Backend = "disk"
|
cfg.Repo.Backend = "disk"
|
||||||
cfg.Repo.Disk.Path = dataPath
|
cfg.Repo.Disk.Path = dataPath
|
||||||
cfg.DemoUsersAndGroups = true
|
cfg.DemoUsersAndGroups = true
|
||||||
|
cfg.Log = &config.Log{}
|
||||||
var hdlr *svc.Service
|
var hdlr *svc.Service
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if hdlr, err = svc.New(svc.Logger(oclog.LoggerFromConfig("accounts", shared.Log(cfg.Log))), svc.Config(cfg), svc.RoleService(buildRoleServiceMock())); err != nil {
|
hdlr, err = svc.New(
|
||||||
|
svc.Logger(logging.Configure(cfg.Service.Name, cfg.Log)),
|
||||||
|
svc.Config(cfg),
|
||||||
|
svc.RoleService(buildRoleServiceMock()),
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
log.Fatalf("Could not create new service")
|
log.Fatalf("Could not create new service")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +500,7 @@ func TestUpdateAccount(t *testing.T) {
|
|||||||
GidNumber: 30001,
|
GidNumber: 30001,
|
||||||
Mail: "एलिस@उदाहरण.com",
|
Mail: "एलिस@उदाहरण.com",
|
||||||
},
|
},
|
||||||
merrors.BadRequest(".", "preferred_name 'अद्भुत-एलिस' must be at least the local part of an email"),
|
merrors.BadRequest("com.owncloud.api.accounts", "preferred_name 'अद्भुत-एलिस' must be at least the local part of an email"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Update user with empty data values",
|
"Update user with empty data values",
|
||||||
@@ -506,7 +512,7 @@ func TestUpdateAccount(t *testing.T) {
|
|||||||
GidNumber: 0,
|
GidNumber: 0,
|
||||||
Mail: "",
|
Mail: "",
|
||||||
},
|
},
|
||||||
merrors.BadRequest(".", "preferred_name '' must be at least the local part of an email"),
|
merrors.BadRequest("com.owncloud.api.accounts", "preferred_name '' must be at least the local part of an email"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Update user with strange data",
|
"Update user with strange data",
|
||||||
@@ -518,7 +524,7 @@ func TestUpdateAccount(t *testing.T) {
|
|||||||
GidNumber: 1000,
|
GidNumber: 1000,
|
||||||
Mail: "1.2@3.c_@",
|
Mail: "1.2@3.c_@",
|
||||||
},
|
},
|
||||||
merrors.BadRequest(".", "mail '1.2@3.c_@' must be a valid email"),
|
merrors.BadRequest("com.owncloud.api.accounts", "mail '1.2@3.c_@' must be a valid email"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var _ = Describe("Crypto", func() {
|
|||||||
var (
|
var (
|
||||||
userConfigDir string
|
userConfigDir string
|
||||||
err error
|
err error
|
||||||
config = cfg.New()
|
config = cfg.DefaultConfig()
|
||||||
)
|
)
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ func init() {
|
|||||||
Path: dataPath,
|
Path: dataPath,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Log: accountsCfg.Log{
|
Log: &accountsCfg.Log{
|
||||||
Level: "info",
|
Level: "info",
|
||||||
Pretty: true,
|
Pretty: true,
|
||||||
Color: true,
|
Color: true,
|
||||||
@@ -694,7 +694,7 @@ func getService() svc.Service {
|
|||||||
TokenManager: config.TokenManager{
|
TokenManager: config.TokenManager{
|
||||||
JWTSecret: jwtSecret,
|
JWTSecret: jwtSecret,
|
||||||
},
|
},
|
||||||
Log: config.Log{
|
Log: &config.Log{
|
||||||
Level: "debug",
|
Level: "debug",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
|
||||||
|
|
||||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -215,7 +213,7 @@ func (tc *testCase) expectProxyTo(strURL string) testCase {
|
|||||||
|
|
||||||
func testConfig(policy []config.Policy) *config.Config {
|
func testConfig(policy []config.Policy) *config.Config {
|
||||||
return &config.Config{
|
return &config.Config{
|
||||||
Log: &shared.Log{},
|
Log: &config.Log{},
|
||||||
Debug: config.Debug{},
|
Debug: config.Debug{},
|
||||||
HTTP: config.HTTP{},
|
HTTP: config.HTTP{},
|
||||||
Tracing: config.Tracing{},
|
Tracing: config.Tracing{},
|
||||||
|
|||||||
Reference in New Issue
Block a user