subscription_test.go 940 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2018 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. // +build integration
  5. package tests
  6. import (
  7. "testing"
  8. )
  9. func TestDiscoverSubscriptions(t *testing.T) {
  10. client := createClient(t)
  11. subscriptions, err := client.Discover(testWebsiteURL)
  12. if err != nil {
  13. t.Fatal(err)
  14. }
  15. if len(subscriptions) != 1 {
  16. t.Fatalf(`Invalid number of subscriptions, got "%v" instead of "%v"`, len(subscriptions), 2)
  17. }
  18. if subscriptions[0].Title != testFeedTitle {
  19. t.Fatalf(`Invalid feed title, got "%v" instead of "%v"`, subscriptions[0].Title, testFeedTitle)
  20. }
  21. if subscriptions[0].Type != "atom" {
  22. t.Fatalf(`Invalid feed type, got "%v" instead of "%v"`, subscriptions[0].Type, "atom")
  23. }
  24. if subscriptions[0].URL != testFeedURL {
  25. t.Fatalf(`Invalid feed URL, got "%v" instead of "%v"`, subscriptions[0].URL, testFeedURL)
  26. }
  27. }