1
0
Fork 0
miniflux/tests/import_export_test.go
Frédéric Guillot a352aff93b Remove deprecated io/ioutil package
Miniflux now requires at least Go 1.16 and io/util is deprecated.

https://golang.org/doc/go1.16#ioutil
2021-02-16 21:25:21 -08:00

46 lines
948 B
Go

// Copyright 2018 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// +build integration
package tests
import (
"bytes"
"io"
"strings"
"testing"
)
func TestExport(t *testing.T) {
client := createClient(t)
output, err := client.Export()
if err != nil {
t.Fatal(err)
}
if !strings.HasPrefix(string(output), "<?xml") {
t.Fatalf(`Invalid OPML export, got "%s"`, string(output))
}
}
func TestImport(t *testing.T) {
client := createClient(t)
data := `<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
<body>
<outline text="Test Category">
<outline title="Test" text="Test" xmlUrl="` + testFeedURL + `" htmlUrl="` + testWebsiteURL + `"></outline>
</outline>
</body>
</opml>`
b := bytes.NewReader([]byte(data))
err := client.Import(io.NopCloser(b))
if err != nil {
t.Fatal(err)
}
}