adjust export tests

This commit is contained in:
Umputun
2018-12-21 00:13:13 -06:00
parent 110566a658
commit a0dff0a4f0
4 changed files with 7 additions and 8 deletions
+1 -2
View File
@@ -22,7 +22,7 @@ var testDb = "/tmp/test-remark.db"
func TestRemark_Export(t *testing.T) {
defer os.Remove(testDb)
b := prep(t)
b := prep(t) // write 2 comments
b.SetReadOnly(store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, true)
b.SetBlock("radio-t", "user-2", true, time.Hour)
b.SetVerified("radio-t", "user-1", true)
@@ -61,7 +61,6 @@ func TestRemark_Export(t *testing.T) {
assert.Equal(t, 1, len(res.Meta.Posts))
assert.Equal(t, "https://radio-t.com", res.Meta.Posts[0].URL)
assert.Equal(t, true, res.Meta.Posts[0].ReadOnly)
}
func TestRemark_Import(t *testing.T) {
+2 -2
View File
@@ -455,7 +455,7 @@ func TestAdmin_ExportStream(t *testing.T) {
body, code := getWithAuth(t, ts.URL+"/api/v1/admin/export?site=radio-t&mode=stream")
assert.Equal(t, 200, code)
assert.Equal(t, 2, strings.Count(body, "\n"))
assert.Equal(t, 6, strings.Count(body, "\n"))
assert.Equal(t, 2, strings.Count(body, "\"text\""))
t.Logf("%s", body)
}
@@ -487,7 +487,7 @@ func TestAdmin_ExportFile(t *testing.T) {
assert.NoError(t, err)
ungzBody, err := ioutil.ReadAll(ungzReader)
assert.NoError(t, err)
assert.Equal(t, 2, strings.Count(string(ungzBody), "\n"))
assert.Equal(t, 6, strings.Count(string(ungzBody), "\n"))
assert.Equal(t, 2, strings.Count(string(ungzBody), "\"text\""))
t.Logf("%s", string(ungzBody))
}
+3 -3
View File
@@ -15,7 +15,7 @@ import (
"testing"
"time"
"github.com/coreos/bbolt"
bolt "github.com/coreos/bbolt"
"github.com/go-chi/chi"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -234,7 +234,7 @@ func TestMigrator_Export(t *testing.T) {
assert.NoError(t, err)
ungzBody, err := ioutil.ReadAll(ungzReader)
assert.NoError(t, err)
assert.Equal(t, 2, strings.Count(string(ungzBody), "\n"))
assert.Equal(t, 6, strings.Count(string(ungzBody), "\n"))
assert.Equal(t, 2, strings.Count(string(ungzBody), "\"text\""))
t.Logf("%s", string(ungzBody))
@@ -248,7 +248,7 @@ func TestMigrator_Export(t *testing.T) {
body, err := ioutil.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, 2, strings.Count(string(body), "\n"))
assert.Equal(t, 6, strings.Count(string(body), "\n"))
assert.Equal(t, 2, strings.Count(string(body), "\"text\""))
t.Logf("%s", string(body))
+1 -1
View File
@@ -392,7 +392,7 @@ func TestService_Metas(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, 1, len(um))
assert.Equal(t, "user1", um[0].UserID)
assert.Equal(t, "user1", um[0].ID)
assert.Equal(t, true, um[0].Verified)
assert.Equal(t, false, um[0].Blocked.Status)