cmd/syncthing: Add mock types for API service testing

This commit is contained in:
Jakob Borg
2016-03-24 08:09:13 +00:00
committed by Audrius Butkevicius
parent a28f890e83
commit 52c74ad866
7 changed files with 304 additions and 0 deletions

View File

@@ -175,3 +175,23 @@ func TestDirNames(t *testing.T) {
t.Errorf("Unexpected dirNames return: %#v\n%s", names, diff)
}
}
func TestInstantiateAPIService(t *testing.T) {
model := new(mockedModel)
cfg := new(mockedConfig)
httpsCertFile := "../../test/h1/https-cert.pem"
httpsKeyFile := "../../test/h1/https-key.pem"
assetDir := "../../gui"
eventSub := new(mockedEventSub)
discoverer := new(mockedCachingMux)
relayService := new(mockedRelayService)
errorLog := new(mockedLoggerRecorder)
systemLog := new(mockedLoggerRecorder)
svc, err := newAPIService(protocol.LocalDeviceID, cfg, httpsCertFile, httpsKeyFile, assetDir, model,
eventSub, discoverer, relayService, errorLog, systemLog)
if err != nil {
t.Fatal(err)
}
_ = svc
}