all: Hide implementations behind interfaces for mocked testing (#5548)

* lib/model: Hide implementations behind interfaces for mocked testing

* review
This commit is contained in:
Simon Frei
2019-02-26 09:09:25 +01:00
committed by Audrius Butkevicius
parent 8a05492622
commit 722b3fce6a
30 changed files with 405 additions and 270 deletions

View File

@@ -93,7 +93,7 @@ func TestDeviceConfig(t *testing.T) {
t.Fatal("Unexpected file")
}
cfg := wr.cfg
cfg := wr.(*wrapper).cfg
expectedFolders := []FolderConfiguration{
{
@@ -515,7 +515,7 @@ func TestNewSaveLoad(t *testing.T) {
cfg := Wrap(path, intCfg)
// To make the equality pass later
cfg.cfg.XMLName.Local = "configuration"
cfg.(*wrapper).cfg.XMLName.Local = "configuration"
if exists(path) {
t.Error(path, "exists")
@@ -827,7 +827,7 @@ func TestIgnoredFolders(t *testing.T) {
// 2 for folder2, 1 for folder1, as non-existing device and device the folder is shared with is removed.
expectedIgnoredFolders := 3
for _, dev := range wrapper.cfg.Devices {
for _, dev := range wrapper.Devices() {
expectedIgnoredFolders -= len(dev.IgnoredFolders)
}
if expectedIgnoredFolders != 0 {