From db77e551191b8f60ab657b549bc5499b9266cf69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Sat, 25 Nov 2017 15:38:43 -0800 Subject: [PATCH] Add integration test for discover endpoint --- integration_test.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/integration_test.go b/integration_test.go index 2690dbba..9d7002db 100644 --- a/integration_test.go +++ b/integration_test.go @@ -466,7 +466,6 @@ func TestDeleteCategory(t *testing.T) { func TestCannotDeleteCategoryOfAnotherUser(t *testing.T) { username := getRandomUsername() client := miniflux.NewClient(testBaseURL, testAdminUsername, testAdminPassword) - categories, err := client.Categories() if err != nil { t.Fatal(err) @@ -484,6 +483,30 @@ func TestCannotDeleteCategoryOfAnotherUser(t *testing.T) { } } +func TestDiscoverSubscriptions(t *testing.T) { + client := miniflux.NewClient(testBaseURL, testAdminUsername, testAdminPassword) + subscriptions, err := client.Discover("https://miniflux.net") + if err != nil { + t.Fatal(err) + } + + if len(subscriptions) != 1 { + t.Fatalf(`Invalid number of subscriptions, got "%v" instead of "%v"`, len(subscriptions), 2) + } + + if subscriptions[0].Title != "Feed" { + t.Fatalf(`Invalid userID, got "%v" instead of "%v"`, subscriptions[0].Title, "Feed") + } + + if subscriptions[0].Type != "atom" { + t.Fatalf(`Invalid userID, got "%v" instead of "%v"`, subscriptions[0].Type, "atom") + } + + if subscriptions[0].URL != "https://miniflux.net/feed" { + t.Fatalf(`Invalid userID, got "%v" instead of "%v"`, subscriptions[0].URL, "https://miniflux.net/feed") + } +} + func getRandomUsername() string { rand.Seed(time.Now().UnixNano()) var suffix []string