| //search | //search | ||||
| for i := 0; i < 10; i++ { | for i := 0; i < 10; i++ { | ||||
| log.Printf("trying to match %d , %s", i, ids[i]) | |||||
| log.Printf("trying to match %d using email, %s", i, ids[i]) | |||||
| total, list, err := crmFindEntityByAttr("Lead", "emailAddress", fmt.Sprintf("abc%d@gmail.com", i)) | total, list, err := crmFindEntityByAttr("Lead", "emailAddress", fmt.Sprintf("abc%d@gmail.com", i)) | ||||
| result := list.([]crmdLead) | result := list.([]crmdLead) | ||||
| AssertEqual(t, err, nil, "find by attr should have no error") | AssertEqual(t, err, nil, "find by attr should have no error") | ||||
| AssertEqual(t, total, 1, "should have found 1 and only 1") | AssertEqual(t, total, 1, "should have found 1 and only 1") | ||||
| AssertEqual(t, len(result), 1, "list should be 1 ") | AssertEqual(t, len(result), 1, "list should be 1 ") | ||||
| AssertEqual(t, result[0].ID, ids[i], "the id should be correct.") | AssertEqual(t, result[0].ID, ids[i], "the id should be correct.") | ||||
| log.Printf("trying to match %d using WechatId,%s", i, ids[i]) | |||||
| total, list, err = crmFindEntityByAttr("Lead", "wechat_hitxy_id", fmt.Sprintf("someopenid-%d", i)) | |||||
| result = list.([]crmdLead) | |||||
| AssertEqual(t, err, nil, "find by attr should have no error") | |||||
| AssertEqual(t, total, 1, "should have found 1 and only 1") | |||||
| AssertEqual(t, len(result), 1, "list should be 1 ") | |||||
| AssertEqual(t, result[0].ID, ids[i], "the id should be correct.") | |||||
| } | } | ||||
| for i := 0; i < 10; i++ { | for i := 0; i < 10; i++ { |