123456789101112131415161718192021222324252627282930313233343536373839 |
- package filesdk
- import (
- "io/ioutil"
- "os"
- "testing"
- )
- func TestMain(m *testing.M) {
- i := Config{
- Host: "http://127.0.0.1:18199",
- }
- i.Init()
- m.Run()
- }
- func Test_Persistent_file(t *testing.T) {
- var hash = "sss"
- if err := GetHandle().HandlePersistent(hash); err != nil {
- t.Errorf("GetHandle().HandlePersistent() error %s", err)
- return
- }
- }
- func TestConfigHandle_Upload(t *testing.T) {
- fileBytes, err := os.Open("logo.png")
- if err != nil {
- t.Fatal(err)
- }
- buf, err := ioutil.ReadAll(fileBytes)
- if err != nil {
- t.Fatal(err)
- }
- result, err := GetHandle().Upload("test.jpg", "testbucket", nil, buf)
- if err != nil {
- t.Fatal(err)
- }
- t.Log(result)
- }
|