提交 d38f581f 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

test restapi

上级 3237dc45
......@@ -15,8 +15,10 @@ var (
NewLine = "\n"
RootPath = ""
ZentaoPort = 58080
ZentaoSiteUrl = fmt.Sprintf("http://127.0.0.1:%d", ZentaoPort)
ZentaoPort = 58080
ZentaoSiteUrl = fmt.Sprintf("http://127.0.0.1:%d", ZentaoPort)
ZentaoUsername = "admin"
ZentaoPassword = "Test123456."
ZtfUrl = "http://127.0.0.1:8000/"
)
......
package httpHelper
import (
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
"github.com/go-git/go-git/v5"
"os"
)
func CloneGit(gitUrl string, name string) error {
projectDir := name
fileUtils.MkDirIfNeeded(projectDir)
options := git.CloneOptions{
URL: gitUrl,
Progress: os.Stdout,
}
_, err := git.PlainClone(projectDir, false, &options)
return err
}
package httpHelper
import (
commDomain "github.com/easysoft/zentaoatf/internal/pkg/domain"
zentaoHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/zentao"
constTestHelper "github.com/easysoft/zentaoatf/test/helper/conf"
)
func Login() (err error) {
config := commDomain.WorkspaceConf{
Url: constTestHelper.ZtfUrl,
Username: constTestHelper.ZentaoUsername,
Password: constTestHelper.ZentaoPassword,
}
zentaoHelper.Login(config)
return
}
......@@ -6,6 +6,7 @@ import (
constTestHelper "github.com/easysoft/zentaoatf/test/helper/conf"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
"log"
"testing"
)
......@@ -24,9 +25,9 @@ func (s *ProductApiSuite) BeforeEach(t provider.T) {
func (s *ProductApiSuite) TestProductApi(t provider.T) {
url := fmt.Sprintf("http://127.0.0.1:%d/api.php/v1/products", constTestHelper.ZentaoPort)
httpUtils.Get(url)
resp, _ := httpUtils.Get(url)
t.WithNewStep("My Second Step!", func(sCtx provider.StepCtx) {
sCtx.NewStep("My First SubStep!")
})
log.Print(resp)
t.Require().Equal(1, 1, "Assertion Failed")
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册