Fix tests
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user