package main import "testing" import "log" import "encoding/json" func TestCRMAttachFile(t *testing.T) { SetupConfig() r, e := crmCreateAttachment("media_for_test/200x200.png") log.Println(r) log.Println(e) } func TestDecodeJsonResponse(t *testing.T) { msg := ` {"id":"591e55398345683ee","name":"static_qr_code_without_logo.png","deleted":false,"type":"image\/png" ,"size":509,"sourceId":null,"createdAt":"2017-05-19 02:15:21","role":"Attachment","storage":null,"storageFilePath" :null,"global":false,"parentId":null,"parentType":null,"relatedId":null,"relatedType":null,"createdById" :"1","createdByName":"Admin"} ` info := attachmentInfo{} err := json.Unmarshal([]byte(msg), &info) AssertEqual(t, err, nil, "json decode shold be correct") } func TestCRMDownloadAttachment(t *testing.T) { SetupConfig() crmDownloadAttachment("591ef9c61d6ca779c") }