123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- package archives_test
- import (
- "testing"
- "gogs.uu.mdfitnesscao.com/Algor/sdk"
- "gogs.uu.mdfitnesscao.com/Algor/sdk/archives"
- "gogs.uu.mdfitnesscao.com/Algor/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 := archives.Detail("B8JB6J0d", "", "")
- list := response.Data.Detail
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("list: %v", list)
- })
- }
- func TestGetArchivesDataListByDate(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.ListUpdatedArchivesDataByDate("2023-09-15", "aaaaa")
- list := response.Data.List
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("list: %v", utils.JsonEncode(list))
- })
- }
- func TestGetArchivesListByDate(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.ListUpdatedArchivesByDate("2023-09-15")
- list := response.Data.List
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("lista :%v", list)
- })
- }
- func TestCheckIsArchivesFamily(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, _ := archives.CheckIsArchivesFamily([]string{
- "pWJM3jrG",
- "Ydm62mB8",
- })
- isFamily := response.Data["isFamily"]
- t.Logf("lista :%v", isFamily)
- })
- }
- func TestGetArchivesListByIds(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.ListArchivesById([]string{
- "Ydm660mB", "8VjdwPm4", "123",
- }, "", "", 0)
- list := response.Data.List
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("lista :%v", list)
- })
- }
- func TestCreateArchives(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.Create(&sdk.Archives{
- Name: "哈哈哈哈",
- Gender: 1,
- Birthday: "2023-09-15",
- Accounts: []*sdk.Account{
- {
- Account: "18523523535",
- Type: 1,
- },
- },
- })
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("response :%v", response)
- })
- }
- func TestCreateArchivesOrFindByAccount(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.CreateOrFindByAccount(&sdk.Archives{
- Name: "哈哈哈哈12",
- Gender: 1,
- Birthday: "2023-09-15",
- Accounts: []*sdk.Account{
- {
- Account: "zhangsan_hhhh",
- Type: 3,
- },
- },
- }, &sdk.ArchivesAttachForm{
- ChannelId: 3,
- }, &sdk.Account{
- Account: "zhangsan_hhhh",
- Type: 3,
- })
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("response :%v", response)
- })
- }
- func TestTriggerArchivesMedicalReport(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.TriggerArchivesMedicalReport("WNm0dm07")
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("response :%v", response)
- })
- }
- func TestGetArchivesValues(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.GetArchivesValues("yojkwRjZ", []string{"medicationStatus"})
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("response :%v", response)
- })
- }
- func TestPaginateArchives(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.PaginateArchives(&sdk.ArchivesPaginateQuery{
- Page: 1,
- PageSize: 100,
- RegistMechanismId: "Xwlg97rP",
- AgeEnd: 200,
- }, "", "")
- list := response.Data.List
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("list :%v", list)
- })
- }
- func TestListArchivesIds(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, err := archives.ListArchivesIds(nil, "Xwlg97rP", "yEw98oR0")
- list := response.Data.List
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("list :%v", list)
- })
- }
- func TestGetValidArchivesIdsForMechanism(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, _ := archives.GetValidArchivesIdsForMechanism([]string{
- "pWJM3jrG",
- "Ydm62mB8",
- }, "M57wVRNZ")
- isFamily := response.Data.List
- t.Logf("lista :%v", isFamily)
- })
- }
- func TestListChannelByIds(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- response, _ := archives.ListChannelByIds([]int64{
- 3,
- }, "")
- isFamily := response.Data.List
- t.Logf("list :%v", isFamily)
- })
- }
|