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

imfs_test.go 765 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package imsdk
  2. import (
  3. "io"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func Test_IPFSRead(t *testing.T) {
  8. Convey("读取IPFS文件", t, func() {
  9. cli := NewClient(&Config{
  10. URL: "http://localhost:7893",
  11. })
  12. file, err := cli.IPFSRead(IPFSRead{
  13. FileHash: "QmcYsRZxmYGgSaydEiJwJRMsD8uWzS2x8gCt1iGMtsZKsU",
  14. Length: 2,
  15. })
  16. So(err, ShouldBeNil)
  17. defer file.Close()
  18. data, err := io.ReadAll(file)
  19. So(err, ShouldBeNil)
  20. So(len(data), ShouldEqual, 2)
  21. })
  22. }
  23. func Test_Package(t *testing.T) {
  24. Convey("获取Package文件列表", t, func() {
  25. cli := NewClient(&Config{
  26. URL: "http://localhost:7893",
  27. })
  28. _, err := cli.PackageGetWithObjects(PackageGetWithObjectsInfos{UserID: 1, PackageID: 13})
  29. So(err, ShouldBeNil)
  30. })
  31. }