Renamed bridge to general users and keep bridge only for bridge stuff

This commit is contained in:
Michal Horejsek
2020-05-21 14:37:15 +02:00
parent 4e2ab9b389
commit 4d2baa6b85
30 changed files with 720 additions and 661 deletions

View File

@ -20,6 +20,7 @@ package context
import (
"github.com/ProtonMail/proton-bridge/internal/bridge"
"github.com/ProtonMail/proton-bridge/internal/preferences"
"github.com/ProtonMail/proton-bridge/internal/users"
"github.com/ProtonMail/proton-bridge/pkg/listener"
)
@ -57,9 +58,9 @@ func (ctx *TestContext) RestartBridge() error {
func newBridgeInstance(
t *bddT,
cfg *fakeConfig,
credStore bridge.CredentialsStorer,
credStore users.CredentialsStorer,
eventListener listener.Listener,
clientManager bridge.ClientManager,
clientManager users.ClientManager,
) *bridge.Bridge {
panicHandler := &panicHandler{t: t}
pref := preferences.New(cfg)

View File

@ -23,8 +23,8 @@ import (
"path/filepath"
"time"
"github.com/ProtonMail/proton-bridge/internal/bridge"
"github.com/ProtonMail/proton-bridge/internal/store"
"github.com/ProtonMail/proton-bridge/internal/users"
"github.com/ProtonMail/proton-bridge/pkg/srp"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
@ -56,7 +56,7 @@ func (ctx *TestContext) LoginUser(username, password, mailboxPassword string) (e
}
// GetUser retrieves the bridge user matching the given query string.
func (ctx *TestContext) GetUser(username string) (*bridge.User, error) {
func (ctx *TestContext) GetUser(username string) (*users.User, error) {
return ctx.bridge.GetUser(username)
}

View File

@ -20,6 +20,7 @@ package context
import (
"github.com/ProtonMail/proton-bridge/internal/bridge"
"github.com/ProtonMail/proton-bridge/internal/users"
"github.com/ProtonMail/proton-bridge/pkg/listener"
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
"github.com/ProtonMail/proton-bridge/test/accounts"
@ -48,7 +49,7 @@ type TestContext struct {
// Bridge core related variables.
bridge *bridge.Bridge
bridgeLastError error
credStore bridge.CredentialsStorer
credStore users.CredentialsStorer
// IMAP related variables.
imapAddr string

View File

@ -20,7 +20,7 @@ package context
import (
"strings"
"github.com/ProtonMail/proton-bridge/internal/bridge/credentials"
"github.com/ProtonMail/proton-bridge/internal/users/credentials"
)
// bridgePassword is password to be used for IMAP or SMTP under tests.

View File

@ -12,7 +12,7 @@ Feature: IMAP auth
Scenario: Authenticates with disconnected user
Given there is disconnected user "user"
When IMAP client authenticates "user"
Then IMAP response is "IMAP error: NO bridge account is logged out, use bridge to login again"
Then IMAP response is "IMAP error: NO account is logged out, use the app to login again"
Scenario: Authenticates with connected user that was loaded without internet
Given there is connected user "user"
@ -31,13 +31,13 @@ Feature: IMAP auth
Given there is connected user "user"
When "user" logs out from bridge
And IMAP client authenticates "user"
Then IMAP response is "IMAP error: NO bridge account is logged out, use bridge to login again"
Then IMAP response is "IMAP error: NO account is logged out, use the app to login again"
Scenario: Authenticates user which was re-logged in
Given there is connected user "user"
When "user" logs out from bridge
And IMAP client authenticates "user"
Then IMAP response is "IMAP error: NO bridge account is logged out, use bridge to login again"
Then IMAP response is "IMAP error: NO account is logged out, use the app to login again"
When "user" logs in to bridge
And IMAP client authenticates "user"
Then IMAP response is "OK"

View File

@ -19,7 +19,7 @@ Feature: SMTP auth
Scenario: Authenticates with disconnected user
Given there is disconnected user "user"
When SMTP client authenticates "user"
Then SMTP response is "SMTP error: 454 bridge account is logged out, use bridge to login again"
Then SMTP response is "SMTP error: 454 account is logged out, use the app to login again"
Scenario: Authenticates with no user
When SMTP client authenticates with username "user@pm.me" and password "bridgepassword"