package dingdingapi

import (
	"testing"
)

func TestCrypt(t *testing.T) {
	//api.RegisterCallback(nil, "token", "M3Z1b1FIXjlAWW84bEVxNENHSlZOUFJEbkAlRUZQXnE", "")
	//encryptedMsg, err := api.Encrypt("hello")
	//decryptedMsg, err := api.Decrypt(encryptedMsg)
	//t.Log(encryptedMsg, decryptedMsg, err)
}

func TestDecrypt(t *testing.T) {
	//api.RegisterCallback(nil, "j9JMGyaZs&vxqt&S", "VFFjTnZrZDJZZmZHJksxeTlxcnp5aG42WmRCbXl3REE", "")
	//encryptedMsg := "L+CkLbztRNz104HWXbFJInfrUuleuB7Q/Il1bgkMA4Ovy6OgObmL9o7smUTxzdNMRFrnjPSJ5Hmfzrsn3a1QVAWgRGJhPrc9mQcbb2rtNu9M0x9o+4xGKAWkb18Roqp4"
	//decryptedMsg, err := api.Decrypt(encryptedMsg)
	//if err != nil {
	//	t.Fatal(err)
	//} else {
	//	baseapi.SugarLogger.Debugf("decryptedMsg:%s\n", decryptedMsg)
	//}
}

func TestPackCallbackResult(t *testing.T) {
	api.RegisterCallback(nil, "token", "M3Z1b1FIXjlAWW84bEVxNENHSlZOUFJEbkAlRUZQXnE", "")
	success := api.PackCallbackResult("success")
	t.Log(success)
}

func TestRegisterCallback(t *testing.T) {
	err := api.RegisterCallback([]string{CBTagUserAddOrg}, "token", "M3Z1b1FIXjlAWW84bEVxNENHSlZOUFJEbkAlRUZQXnE", "http://callback.test.jxc4.com/dingding/msg")
	t.Log(err)
}

func TestDeleteCallback(t *testing.T) {
	err := api.DeleteCallback()
	t.Log(err)
}
