Преглед изворни кода

match another attribute

master
Patrick Peng Sun пре 8 година
родитељ
комит
250fe57201
1 измењених фајлова са 10 додато и 1 уклоњено
  1. +10
    -1
      crmEntity_test.go

+ 10
- 1
crmEntity_test.go Прегледај датотеку



//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++ {

Loading…
Откажи
Сачувај