diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-08-25 11:53:14 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-08-25 11:55:47 -0700 |
commit | febce4f2e3a86da4171783fcc593b25a807c3da8 (patch) | |
tree | 3e15ba526680fda44620bc81a49f2d844a77a087 /tests/import_export_test.go | |
parent | df2bebaf3dc9ab46c03883d795ae6637faa4a2c1 (diff) |
Split integration tests into multiple files
Diffstat (limited to 'tests/import_export_test.go')
-rw-r--r-- | tests/import_export_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/import_export_test.go b/tests/import_export_test.go new file mode 100644 index 0000000..6011475 --- /dev/null +++ b/tests/import_export_test.go @@ -0,0 +1,46 @@ +// 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/ioutil" + "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(ioutil.NopCloser(b)) + if err != nil { + t.Fatal(err) + } +} |