test: fix most integration tests (live)

This commit is contained in:
James Houlahan
2020-04-09 10:24:58 +02:00
parent bafd4e714e
commit fec5f2d3c3
18 changed files with 124 additions and 104 deletions

View File

@ -24,6 +24,7 @@ import (
"github.com/ProtonMail/proton-bridge/internal/bridge"
"github.com/ProtonMail/proton-bridge/internal/preferences"
"github.com/ProtonMail/proton-bridge/pkg/listener"
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
)
// GetBridge returns bridge instance.
@ -59,7 +60,7 @@ func newBridgeInstance(
cfg *fakeConfig,
credStore bridge.CredentialsStorer,
eventListener listener.Listener,
clientManager bridge.ClientManager,
clientManager *pmapi.ClientManager,
) *bridge.Bridge {
version := os.Getenv("VERSION")
bridge.UpdateCurrentUserAgent(version, runtime.GOOS, "", "")

View File

@ -35,17 +35,20 @@ type server interface {
// TestContext manages a bridge test (mocked API, bridge instance, IMAP/SMTP servers, setup steps).
type TestContext struct {
// Base setup for the whole bridge (core & imap & smtp).
t *bddT
cfg *fakeConfig
listener listener.Listener
pmapiController PMAPIController // pmapiController is used to create pmapi clients (either real or fake) and control server state.
testAccounts *accounts.TestAccounts
t *bddT
cfg *fakeConfig
listener listener.Listener
testAccounts *accounts.TestAccounts
// pmapiController is used to control real or fake pmapi clients.
// The clients are created by the clientManager.
pmapiController PMAPIController
clientManager *pmapi.ClientManager
// Bridge core related variables.
bridge *bridge.Bridge
bridgeLastError error
credStore bridge.CredentialsStorer
clientManager *pmapi.ClientManager
// IMAP related variables.
imapAddr string