2024-03-25 16:24:48: merge [main:72a62d1996eb71f9a1ab21643bf294148b87ae99];
This commit is contained in:
1 parent
0669c6ec0a
commit
ed8a4eef5d
85 files changed
+7671
-93
No files matched your search
@@ -0,0 +1,65 @@
|
||||
package tests_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/integration-system/isp-kit/dbx"
|
||||
"github.com/integration-system/isp-kit/grpc/client"
|
||||
"github.com/integration-system/isp-kit/test"
|
||||
"github.com/integration-system/isp-kit/test/dbt"
|
||||
"github.com/integration-system/isp-kit/test/grpct"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"msp-admin-service/assembly"
|
||||
"msp-admin-service/conf"
|
||||
)
|
||||
|
||||
func TestCustomizationTestSuite(t *testing.T) {
|
||||
t.Parallel()
|
||||
suite.Run(t, &CustomizationTestSuite{})
|
||||
}
|
||||
|
||||
type CustomizationTestSuite struct {
|
||||
suite.Suite
|
||||
test *test.Test
|
||||
db *dbt.TestDb
|
||||
grpcCli *client.Client
|
||||
}
|
||||
|
||||
func (s *CustomizationTestSuite) SetupTest() {
|
||||
testInstance, _ := test.New(s.T())
|
||||
s.test = testInstance
|
||||
s.db = dbt.New(testInstance, dbx.WithMigration("../migrations"))
|
||||
|
||||
remote := conf.Remote{
|
||||
UiDesign: conf.UIDesign{
|
||||
Name: "test",
|
||||
PrimaryColor: "#ff4d4f",
|
||||
},
|
||||
ExpireSec: 0,
|
||||
}
|
||||
cfg := assembly.NewLocator(testInstance.Logger(), nil, s.db).
|
||||
Config(context.Background(), emptyLdap, remote)
|
||||
|
||||
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
||||
s.grpcCli = apiCli
|
||||
|
||||
testInstance.T().Cleanup(func() {
|
||||
server.Shutdown()
|
||||
})
|
||||
}
|
||||
|
||||
func (s *CustomizationTestSuite) TestGetDesign() {
|
||||
response := conf.UIDesign{}
|
||||
err := s.grpcCli.
|
||||
Invoke("admin/user/get_design").
|
||||
JsonRequestBody(struct{}{}).
|
||||
JsonResponseBody(&response).
|
||||
Do(context.Background())
|
||||
s.Require().NoError(err)
|
||||
expected := conf.UIDesign{
|
||||
Name: "test",
|
||||
PrimaryColor: "#ff4d4f",
|
||||
}
|
||||
s.Require().Equal(expected, response)
|
||||
}
|
||||
Reference in new issue
Block a user