Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

710 B
Raw Blame
package controller

import (
	"errors"
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/ente/museum/pkg/external/listmonk"
)

func TestListmonkUnsubscribeDoesNotNotifyWhenSubscriberIsMissing(t *testing.T) {
	server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		_, _ = w.Write([]byte(`{"data":{"results":[]}}`))
	}))
	defer server.Close()

	c := &MailingListsController{
		listmonkCredentials: listmonk.Credentials{
			BaseURL:  server.URL,
			Username: "user",
			Password: "pass",
		},
	}

	err := c.listmonkUnsubscribe("[email protected]")
	if !errors.Is(err, listmonk.ErrSubscriberNotFound) {
		t.Fatalf("err = %v, want ErrSubscriberNotFound", err)
	}
}