瀏覽代碼

minor letter typo change

master
Patrick Peng Sun 8 年之前
父節點
當前提交
2673148728
共有 2 個檔案被更改,包括 8 行新增11 行删除
  1. +0
    -3
      crmEntity.go
  2. +8
    -8
      crmEntity_test.go

+ 0
- 3
crmEntity.go 查看文件

@@ -104,6 +104,3 @@ func isErrIndicateDuplicate(e error) (yes bool) {
yes = strings.ToLower(reason.Reason) == "duplicate"
return
}


func searchEntity

+ 8
- 8
crmEntity_test.go 查看文件

@@ -6,7 +6,7 @@ import (
"time"
)

func TestCreateEntity(t *testing.T) {
func TestCrmCreateEntity(t *testing.T) {
SetupConfig()
e := crmdLead{}
e.FirstName = "ff" + time.Now().Format("2006-jan-02 03:04:05")
@@ -16,7 +16,7 @@ func TestCreateEntity(t *testing.T) {
b, _ := json.Marshal(e)

//Create
entity, _ := createEntity("Lead", b)
entity, _ := crmCreateEntity("Lead", b)
lead1, ok := entity.(crmdLead)
AssertEqual(t, ok, true, "entity type should be crmdLead")

@@ -27,7 +27,7 @@ func TestCreateEntity(t *testing.T) {
//Update
e.Password = "newpass"
b, _ = json.Marshal(e)
entity, _ = updateEntity("Lead", lead2.ID, b)
entity, _ = crmUpdateEntity("Lead", lead2.ID, b)
lead3 := entity.(crmdLead)

AssertEqual(t, lead3.ID, lead1.ID, "should be same lead")
@@ -35,7 +35,7 @@ func TestCreateEntity(t *testing.T) {
AssertEqual(t, lead1.Password, "pp", "old password should be PP")

//Delete this test lead.
deleted, _ := deleteEntity("Lead", lead1.ID)
deleted, _ := crmDeleteEntity("Lead", lead1.ID)
AssertEqual(t, deleted, true, "record should be deleted")

}
@@ -51,7 +51,7 @@ func TestCreateDuplicate(t *testing.T) {
b, _ := json.Marshal(e)

//create
entity, _ := createEntity("Lead", b)
entity, _ := crmCreateEntity("Lead", b)
lead1 := entity.(crmdLead)

//Read
@@ -60,12 +60,12 @@ func TestCreateDuplicate(t *testing.T) {
AssertEqual(t, lead1.ID, lead2.ID, "lead should have been created successfully")

//try to create it again
entity, err := createEntity("Lead", b)
entity, err := crmCreateEntity("Lead", b)
AssertEqual(t, err == nil, false, "should have error for duplicates")
AssertEqual(t, isErrIndicateDuplicate(err), true, "the err should be duplicate error")
}

func TestCreateEntityServerNotFound(t *testing.T) {
func TestCrmCreateEntityServerNotFound(t *testing.T) {
SetupConfig()
crmSite = "https://not-exist.hitxy.org.au/" //

@@ -76,7 +76,7 @@ func TestCreateEntityServerNotFound(t *testing.T) {
e.Status = "New"
e.WechatHitxyID = "someopenid"
b, _ := json.Marshal(e)
entity, err := createEntity("Lead", b)
entity, err := crmCreateEntity("Lead", b)
AssertEqual(t, isErrIndicateDuplicate(err), false, "this should not be a duplicate error")
AssertEqual(t, entity, nil, "should not be able to create entity, it should be nil")


Loading…
取消
儲存