12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package form_test
- import (
- "fmt"
- "testing"
- "gogs.uu.mdfitnesscao.com/cuiguohai/sdk"
- "gogs.uu.mdfitnesscao.com/cuiguohai/sdk/form"
- "gogs.uu.mdfitnesscao.com/cuiguohai/sdk/utils"
- )
- func TestList(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := form.ListForm([]string{
- "4ZP4Zy52", "pOkrdWA1",
- })
- if err != nil {
- t.Errorf("err: %v", err)
- }
- list := response.Data.List
- t.Logf("list len: %d", len(list))
- })
- }
- func TestDetail(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- response, err := form.DetailForm("4ZP4Zy52", false)
- if err != nil {
- t.Errorf("err: %v", err)
- }
- detail := response.Data.Detail
- t.Logf("list len: %v", detail)
- })
- }
- func TestDetailByCustomFields(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.hhmdtech.com",
- AppDebug: true,
- })
- response, err := form.DetailFormByCustomFields([]*sdk.FormCustomField{
- {
- Type: 2,
- Key: "PsyConditions",
- },
- })
- if err != nil {
- t.Errorf("err: %v", err)
- }
- detail := response.Data.FormFields
- fmt.Println(utils.JsonEncode(detail))
- })
- }
|