You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
932B

  1. package main
  2. import "testing"
  3. import "log"
  4. import "encoding/json"
  5. func TestCRMAttachFile(t *testing.T) {
  6. SetupConfig()
  7. r, e := crmCreateAttachment("media_for_test/200x200.png")
  8. log.Println(r)
  9. log.Println(e)
  10. }
  11. func TestDecodeJsonResponse(t *testing.T) {
  12. msg := `
  13. {"id":"591e55398345683ee","name":"static_qr_code_without_logo.png","deleted":false,"type":"image\/png"
  14. ,"size":509,"sourceId":null,"createdAt":"2017-05-19 02:15:21","role":"Attachment","storage":null,"storageFilePath"
  15. :null,"global":false,"parentId":null,"parentType":null,"relatedId":null,"relatedType":null,"createdById"
  16. :"1","createdByName":"Admin"} `
  17. info := attachmentInfo{}
  18. err := json.Unmarshal([]byte(msg), &info)
  19. AssertEqual(t, err, nil, "json decode shold be correct")
  20. }
  21. func TestCRMDownloadAttachment(t *testing.T) {
  22. SetupConfig()
  23. id := "59054884ef1b0c04f"
  24. //crmDownloadAttachment(id)
  25. crmDownloadAttachmentAs(id, "/tmp/wechat_hitxy_测试")
  26. }