mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Move internal packages to an internal folder
For reference: https://go.dev/doc/go1.4#internalpackages
This commit is contained in:
parent
c234903255
commit
168a870c02
433 changed files with 1121 additions and 1123 deletions
53
internal/tests/subscription_test.go
Normal file
53
internal/tests/subscription_test.go
Normal file
|
@ -0,0 +1,53 @@
|
|||
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package tests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
miniflux "miniflux.app/v2/client"
|
||||
)
|
||||
|
||||
func TestDiscoverSubscriptions(t *testing.T) {
|
||||
client := createClient(t)
|
||||
subscriptions, err := client.Discover(testWebsiteURL)
|
||||
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 != testSubscriptionTitle {
|
||||
t.Fatalf(`Invalid feed title, got "%v" instead of "%v"`, subscriptions[0].Title, testSubscriptionTitle)
|
||||
}
|
||||
|
||||
if subscriptions[0].Type != "atom" {
|
||||
t.Fatalf(`Invalid feed type, got "%v" instead of "%v"`, subscriptions[0].Type, "atom")
|
||||
}
|
||||
|
||||
if subscriptions[0].URL != testFeedURL {
|
||||
t.Fatalf(`Invalid feed URL, got "%v" instead of "%v"`, subscriptions[0].URL, testFeedURL)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiscoverSubscriptionsWithInvalidURL(t *testing.T) {
|
||||
client := createClient(t)
|
||||
_, err := client.Discover("invalid")
|
||||
if err == nil {
|
||||
t.Fatal(`Invalid URLs should be rejected`)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiscoverSubscriptionsWithNoSubscription(t *testing.T) {
|
||||
client := createClient(t)
|
||||
_, err := client.Discover(testBaseURL)
|
||||
if err != miniflux.ErrNotFound {
|
||||
t.Fatal(`A 404 should be returned when there is no subscription`)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue