forked from easysoft/zendata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge 3.1 code Signed-off-by: ysicing <[email protected]>
- Loading branch information
Showing
239 changed files
with
3,112 additions
and
1,669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,5 @@ | |
|
||
/zendata | ||
client/yarn-error.log | ||
**/allure-results/ | ||
/test/unittest/out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0.1 | ||
3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package action | ||
|
||
import ( | ||
"github.com/easysoft/zendata/internal/command" | ||
logUtils "github.com/easysoft/zendata/pkg/utils/log" | ||
) | ||
|
||
func GenData(files []string) { | ||
command.PrintStartInfo() | ||
|
||
err := command.SetOutFormat() | ||
defer logUtils.OutputFileWriter.Close() | ||
if err != nil { | ||
return | ||
} | ||
|
||
mainCtrl, _ := command.InitCtrl() | ||
mainCtrl.Generate(files) | ||
|
||
command.PrintEndInfo() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package action | ||
|
||
import "github.com/easysoft/zendata/internal/command" | ||
|
||
func GenYaml(input string) { | ||
mainCtrl, _ := command.InitCtrl() | ||
mainCtrl.GenYaml(input) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/easysoft/zendata/cmd/test/consts" | ||
testHelper "github.com/easysoft/zendata/cmd/test/helper" | ||
"github.com/easysoft/zendata/internal/pkg/helper" | ||
"github.com/ozontech/allure-go/pkg/framework/provider" | ||
"github.com/ozontech/allure-go/pkg/framework/suite" | ||
) | ||
|
||
func TestDataListCmd(t *testing.T) { | ||
suite.RunSuite(t, new(DataListCmdSuite)) | ||
} | ||
|
||
type DataListCmdSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *DataListCmdSuite) BeforeAll(t provider.T) { | ||
testHelper.BeforeAll() | ||
t.AddSubSuite("DataListCmd") | ||
} | ||
func (s *DataListCmdSuite) BeforeEach(t provider.T) { | ||
testHelper.PreCase() | ||
|
||
t.AddSubSuite("DataListCmd") | ||
} | ||
func (s *DataListCmdSuite) AfterEach(t provider.T) { | ||
testHelper.PostCase() | ||
} | ||
|
||
func (s *DataListCmdSuite) TestDataList(t provider.T) { | ||
t.ID("0") | ||
|
||
helper.ListData() | ||
|
||
out := consts.Buf.String() | ||
|
||
t.Require().Contains(out, "test.v1.yaml", "check list content") | ||
} | ||
|
||
func (s *DataListCmdSuite) TestResList(t provider.T) { | ||
t.ID("0") | ||
|
||
helper.ListRes() | ||
|
||
out := consts.Buf.String() | ||
|
||
t.Require().Contains(out, "city.v1.xlsx", "check list content") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/easysoft/zendata/cmd/test/consts" | ||
testHelper "github.com/easysoft/zendata/cmd/test/helper" | ||
"github.com/easysoft/zendata/internal/pkg/helper" | ||
"github.com/ozontech/allure-go/pkg/framework/provider" | ||
"github.com/ozontech/allure-go/pkg/framework/suite" | ||
) | ||
|
||
func TestDataViewCmd(t *testing.T) { | ||
suite.RunSuite(t, new(DataViewCmdSuite)) | ||
} | ||
|
||
type DataViewCmdSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *DataViewCmdSuite) BeforeAll(t provider.T) { | ||
testHelper.BeforeAll() | ||
t.AddSubSuite("DataListCmd") | ||
} | ||
func (s *DataViewCmdSuite) BeforeEach(t provider.T) { | ||
testHelper.PreCase() | ||
t.AddSubSuite("DataViewCmd") | ||
} | ||
func (s *DataViewCmdSuite) AfterEach(t provider.T) { | ||
testHelper.PostCase() | ||
} | ||
|
||
func (s *DataViewCmdSuite) TestViewDataBuildinExcel(t provider.T) { | ||
t.ID("0") | ||
|
||
consts.Buf.Reset() | ||
helper.View("city.v1.city") | ||
out := consts.Buf.String() | ||
t.Require().Contains(out, "北京市", "check excel content") | ||
} | ||
|
||
func (s *DataViewCmdSuite) TestViewDataBuildinConfig(t provider.T) { | ||
t.ID("0") | ||
|
||
consts.Buf.Reset() | ||
helper.View("color/v1.yaml") | ||
out := consts.Buf.String() | ||
t.Require().Contains(out, "rgb", "check excel content") | ||
|
||
consts.Buf.Reset() | ||
helper.View("color.v1.yaml") | ||
out = consts.Buf.String() | ||
|
||
t.Require().Contains(out, "rgb", "check excel content") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/easysoft/zendata/cmd/test/consts" | ||
"github.com/easysoft/zendata/cmd/test/gen" | ||
testHelper "github.com/easysoft/zendata/cmd/test/helper" | ||
"github.com/ozontech/allure-go/pkg/framework/provider" | ||
"github.com/ozontech/allure-go/pkg/framework/suite" | ||
) | ||
|
||
func TestGenerateArticleCmd(t *testing.T) { | ||
suite.RunSuite(t, new(GenerateArticleCmdSuite)) | ||
} | ||
|
||
type GenerateArticleCmdSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *GenerateArticleCmdSuite) BeforeAll(t provider.T) { | ||
testHelper.BeforeAll() | ||
t.AddSubSuite("GenerateArticleCmd") | ||
} | ||
func (s *GenerateArticleCmdSuite) BeforeEach(t provider.T) { | ||
testHelper.PreCase() | ||
t.AddSubSuite("GenerateArticleCmd") | ||
} | ||
func (s *GenerateArticleCmdSuite) AfterEach(t provider.T) { | ||
testHelper.PostCase() | ||
} | ||
|
||
func (s *GenerateArticleCmdSuite) TestGenerateArticle(t provider.T) { | ||
t.ID("0") | ||
|
||
out := gen.New(). | ||
SetConfigs([]string{consts.CommandTestFileArticleConfig}). | ||
SetOutput(consts.CommandTestFileArticleOut). | ||
Gen() | ||
|
||
t.Require().NotContains(out, "{人称代词}", "check generated data") | ||
} |
Oops, something went wrong.