MSP-8974 fix tests
This commit is contained in:
1 parent
71498785ea
commit
fa8bc6c1b7
50 files changed
+392
-2975
No files matched your search
@@ -8,10 +8,10 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/txix-open/isp-kit/grpc/client"
|
||||
"github.com/txix-open/isp-kit/http/httpcli"
|
||||
"github.com/txix-open/isp-kit/test"
|
||||
"github.com/txix-open/isp-kit/test/fake"
|
||||
"github.com/txix-open/isp-kit/test/grpct"
|
||||
"github.com/txix-open/isp-kit/test/httpt"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
@@ -20,7 +20,7 @@ type UiSettingsSuite struct {
|
||||
suite.Suite
|
||||
|
||||
test *test.Test
|
||||
apiCli *client.Client
|
||||
apiCli *httpcli.Client
|
||||
oauthClientSetting conf.OauthClientConfig
|
||||
baseOauthUrl string
|
||||
}
|
||||
@@ -50,22 +50,22 @@ func (s *UiSettingsSuite) SetupTest() {
|
||||
Clients: []conf.OauthClientConfig{s.oauthClientSetting},
|
||||
},
|
||||
}
|
||||
cfg, err := assembly.NewLocator(s.test.Logger(), nil, nil).
|
||||
cfg, err := assembly.NewLocator(s.test.Logger(), nil, nil, nil).
|
||||
Config(s.T().Context(), remote, 0)
|
||||
s.Require().NoError(err)
|
||||
|
||||
_, s.apiCli = grpct.TestServer(s.test, cfg.Handler)
|
||||
_, s.apiCli = httpt.TestServer(s.test, cfg.Handler)
|
||||
}
|
||||
|
||||
func (s *UiSettingsSuite) Test_HappyPath() {
|
||||
var resp domain.UiOauthSetting
|
||||
|
||||
err := s.apiCli.Invoke("admin/ui_settings/oauth").
|
||||
err := s.apiCli.Post("admin/ui_settings/oauth").
|
||||
JsonRequestBody(domain.ClientNameRequest{
|
||||
ClientName: s.oauthClientSetting.ClientName,
|
||||
}).
|
||||
JsonResponseBody(&resp).
|
||||
Do(s.T().Context())
|
||||
DoWithoutResponse(s.T().Context())
|
||||
s.Require().NoError(err)
|
||||
|
||||
loginURL, err := url.Parse(resp.LoginUrl)
|
||||
@@ -93,11 +93,11 @@ func (s *UiSettingsSuite) Test_HappyPath() {
|
||||
}
|
||||
|
||||
func (s *UiSettingsSuite) Test_UnknownClient() {
|
||||
err := s.apiCli.Invoke("admin/ui_settings/oauth").
|
||||
err := s.apiCli.Post("admin/ui_settings/oauth").
|
||||
JsonRequestBody(domain.ClientNameRequest{
|
||||
ClientName: s.oauthClientSetting.ClientName + fake.It[string](),
|
||||
}).
|
||||
Do(s.T().Context())
|
||||
DoWithoutResponse(s.T().Context())
|
||||
s.Require().Error(err)
|
||||
st, ok := status.FromError(err)
|
||||
s.Require().True(ok)
|
||||
|
||||
Reference in new issue
Block a user