From 5cacae6cf2e1f2f59cf294139fd0c626a3b256fc Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 29 Apr 2018 18:56:40 -0700 Subject: Add API endpoint to import OPML file --- integration_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'integration_test.go') 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 := ` + + + + + + + ` + + 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) -- cgit v1.2.3