From 45a68c7fb5d811036075c550fb6fa40069486bf1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 10 Apr 2019 02:47:47 +0300 Subject: Fix tests --- config/config_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'config') diff --git a/config/config_test.go b/config/config_test.go index f782618..4aa076f 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -28,7 +28,7 @@ import ( func TestNewConfig_Defaults(t *testing.T) { cfg := config.NewConfig("/tmp/gomuks-test-0", "/tmp/gomuks-test-0") assert.Equal(t, "/tmp/gomuks-test-0", cfg.Dir) - assert.Equal(t, "/tmp/gomuks-test-0/history", cfg.HistoryDir) + assert.Equal(t, "/tmp/gomuks-test-0/history.db", cfg.HistoryPath) assert.Equal(t, "/tmp/gomuks-test-0/media", cfg.MediaDir) } @@ -43,9 +43,10 @@ func TestConfig_Load_NonexistentDoesntFail(t *testing.T) { assert.Nil(t, err) assert.True(t, stat.IsDir()) + /* FIXME stat, err = os.Stat(cfg.HistoryDir) assert.Nil(t, err) - assert.True(t, stat.IsDir()) + assert.True(t, stat.IsDir())*/ } func TestConfig_Load_DirectoryFails(t *testing.T) { @@ -67,7 +68,7 @@ func TestConfig_Load_ExistingFileIsLoaded(t *testing.T) { ioutil.WriteFile("/tmp/gomuks-test-3/config.yaml", []byte(`{ "mxid": "foo", "homeserver": "bar", - "history_dir": "/tmp/gomuks-test-3/foo", + "history_path": "/tmp/gomuks-test-3/foo.db", "media_dir": "/tmp/gomuks-test-3/bar" }`), 0700) cfg := config.NewConfig("/tmp/gomuks-test-3", "/tmp/gomuks-test-3") @@ -78,16 +79,17 @@ func TestConfig_Load_ExistingFileIsLoaded(t *testing.T) { assert.Equal(t, "foo", cfg.UserID) assert.Equal(t, "bar", cfg.HS) - assert.Equal(t, "/tmp/gomuks-test-3/foo", cfg.HistoryDir) + assert.Equal(t, "/tmp/gomuks-test-3/foo.db", cfg.HistoryPath) assert.Equal(t, "/tmp/gomuks-test-3/bar", cfg.MediaDir) stat, err := os.Stat(cfg.MediaDir) assert.Nil(t, err) assert.True(t, stat.IsDir()) + /* FIXME stat, err = os.Stat(cfg.HistoryDir) assert.Nil(t, err) - assert.True(t, stat.IsDir()) + assert.True(t, stat.IsDir())*/ } func TestConfig_Load_InvalidExistingFilePanics(t *testing.T) { @@ -116,9 +118,10 @@ func TestConfig_Clear(t *testing.T) { assert.Nil(t, err) assert.True(t, stat.IsDir()) + /* FIXME stat, err = os.Stat(cfg.HistoryDir) assert.Nil(t, err) - assert.True(t, stat.IsDir()) + assert.True(t, stat.IsDir())*/ cfg.Clear() @@ -126,9 +129,10 @@ func TestConfig_Clear(t *testing.T) { assert.True(t, os.IsNotExist(err)) assert.Nil(t, stat) + /* FIXME stat, err = os.Stat(cfg.HistoryDir) assert.True(t, os.IsNotExist(err)) - assert.Nil(t, stat) + assert.Nil(t, stat)*/ } func TestConfig_Save(t *testing.T) { -- cgit v1.2.3