Deliver Atom feed items on Misskey
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.
 
 

38 lines
891 B

package publisher_test
import (
"testing"
"gitea.code-infection.com/efertone/kiki/pkg/misskey"
"gitea.code-infection.com/efertone/kiki/pkg/publisher"
)
type MockMisskeyClient struct {
}
func (m MockMisskeyClient) CreateNote(content string, file *misskey.FileCreateResponse) error {
return nil
}
func (m MockMisskeyClient) CreateFile(content []byte, name string) (*misskey.FileCreateResponse, error) {
return nil, nil
}
func (m MockMisskeyClient) CreateFileFromURL(url, name string) (*misskey.FileCreateResponse, error) {
return nil, nil
}
func TestMisskeyPublisher(t *testing.T) {
pub := publisher.NewMisskey("https://localhost", "token")
pub.Client = &MockMisskeyClient{}
if pub.Name() != "misskey" {
t.Errorf("publisher.Name(): expected = misskey; got = %s", pub.Name())
}
err := pub.Publish("test", "")
if err != nil {
t.Errorf("Unexpedted error: %s", err)
}
}