From 250fe5720103db7b4b2671c21a086e10dba1e816 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Fri, 30 Jun 2017 15:50:00 +1000 Subject: [PATCH] match another attribute --- crmEntity_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crmEntity_test.go b/crmEntity_test.go index 7ff713e..70f4861 100644 --- a/crmEntity_test.go +++ b/crmEntity_test.go @@ -182,13 +182,22 @@ func TestSearchByAttr(t *testing.T) { //search 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)) 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.") + + 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++ {