aboutsummaryrefslogtreecommitdiffhomepage
path: root/integration_test.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-04-29 18:56:40 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-04-29 18:56:40 -0700
commit5cacae6cf2e1f2f59cf294139fd0c626a3b256fc (patch)
treef35083d96bb56e58866716c1f81dcbcb8c8db672 /integration_test.go
parent7a1653a2e9e0802677d34f513828b33c0ef5c576 (diff)
Add API endpoint to import OPML file
Diffstat (limited to 'integration_test.go')
-rw-r--r--integration_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/integration_test.go b/integration_test.go
index fb0a785..88ecfa6 100644
--- a/integration_test.go
+++ b/integration_test.go
@@ -7,6 +7,8 @@
package main
import (
+ "bytes"
+ "io/ioutil"
"math/rand"
"strconv"
"strings"
@@ -653,6 +655,32 @@ func TestExport(t *testing.T) {
}
}
+func TestImport(t *testing.T) {
+ username := getRandomUsername()
+ client := miniflux.NewClient(testBaseURL, testAdminUsername, testAdminPassword)
+ _, err := client.CreateUser(username, testStandardPassword, false)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ client = miniflux.NewClient(testBaseURL, username, testStandardPassword)
+
+ 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(ioutil.NopCloser(b))
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestUpdateFeed(t *testing.T) {
username := getRandomUsername()
client := miniflux.NewClient(testBaseURL, testAdminUsername, testAdminPassword)