mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
GODT-1817: Add missing IMAP auth tests with disabled & secondary accounts
This commit is contained in:
@ -171,6 +171,7 @@ func TestFeatures(testingT *testing.T) {
|
|||||||
ctx.Step(`^user "([^"]*)" connects IMAP client "([^"]*)" on port (\d+)$`, s.userConnectsIMAPClientOnPort)
|
ctx.Step(`^user "([^"]*)" connects IMAP client "([^"]*)" on port (\d+)$`, s.userConnectsIMAPClientOnPort)
|
||||||
ctx.Step(`^user "([^"]*)" connects and authenticates IMAP client "([^"]*)"$`, s.userConnectsAndAuthenticatesIMAPClient)
|
ctx.Step(`^user "([^"]*)" connects and authenticates IMAP client "([^"]*)"$`, s.userConnectsAndAuthenticatesIMAPClient)
|
||||||
ctx.Step(`^user "([^"]*)" connects and authenticates IMAP client "([^"]*)" with address "([^"]*)"$`, s.userConnectsAndAuthenticatesIMAPClientWithAddress)
|
ctx.Step(`^user "([^"]*)" connects and authenticates IMAP client "([^"]*)" with address "([^"]*)"$`, s.userConnectsAndAuthenticatesIMAPClientWithAddress)
|
||||||
|
ctx.Step(`^user "([^"]*)" connects and can not authenticate IMAP client "([^"]*)" with address "([^"]*)"$`, s.userConnectsAndCanNotAuthenticateIMAPClientWithAddress)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" can authenticate$`, s.imapClientCanAuthenticate)
|
ctx.Step(`^IMAP client "([^"]*)" can authenticate$`, s.imapClientCanAuthenticate)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" can authenticate with address "([^"]*)"$`, s.imapClientCanAuthenticateWithAddress)
|
ctx.Step(`^IMAP client "([^"]*)" can authenticate with address "([^"]*)"$`, s.imapClientCanAuthenticateWithAddress)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" cannot authenticate$`, s.imapClientCannotAuthenticate)
|
ctx.Step(`^IMAP client "([^"]*)" cannot authenticate$`, s.imapClientCannotAuthenticate)
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
Feature: A user can authenticate an IMAP client
|
Feature: A user can authenticate an IMAP client
|
||||||
Background:
|
Background:
|
||||||
Given there exists an account with username "[user:user]" and password "password"
|
Given there exists an account with username "[user:user]" and password "password"
|
||||||
|
And there exists an account with username "[user2:user2]" and password "password2"
|
||||||
|
And the account "[user:user]" has additional address "[alias:alias]@[domain]"
|
||||||
|
And the account "[user2:user2]" has additional disabled address "[alias2:alias2]@[domain]"
|
||||||
And bridge starts
|
And bridge starts
|
||||||
And the user logs in with username "[user:user]" and password "password"
|
And the user logs in with username "[user:user]" and password "password"
|
||||||
|
And the user logs in with username "[user2:user2]" and password "password2"
|
||||||
|
|
||||||
Scenario: IMAP client can authenticate successfully
|
Scenario: IMAP client can authenticate successfully
|
||||||
When user "[user:user]" connects IMAP client "1"
|
When user "[user:user]" connects IMAP client "1"
|
||||||
@ -12,6 +16,12 @@ Feature: A user can authenticate an IMAP client
|
|||||||
When user "[user:user]" connects IMAP client "1"
|
When user "[user:user]" connects IMAP client "1"
|
||||||
Then IMAP client "1" can authenticate with address "{toUpper:[user:user]@[domain]}"
|
Then IMAP client "1" can authenticate with address "{toUpper:[user:user]@[domain]}"
|
||||||
|
|
||||||
|
Scenario: IMAP client can authenticate successfully with secondary address
|
||||||
|
Given user "[user:user]" connects and authenticates IMAP client "1" with address "[alias:alias]@[domain]"
|
||||||
|
|
||||||
|
Scenario: IMAP client can not authenticate successfully with disable address
|
||||||
|
Given user "[user2:user2]" connects and can not authenticate IMAP client "1" with address "[alias2:alias2]@[domain]"
|
||||||
|
|
||||||
Scenario: IMAP client can authenticate successfully
|
Scenario: IMAP client can authenticate successfully
|
||||||
When user "[user:user]" connects IMAP client "1"
|
When user "[user:user]" connects IMAP client "1"
|
||||||
Then IMAP client "1" can authenticate
|
Then IMAP client "1" can authenticate
|
||||||
|
|||||||
@ -59,6 +59,20 @@ func (s *scenario) userConnectsAndAuthenticatesIMAPClientWithAddress(username, c
|
|||||||
return client.Login(address, s.t.getUserBridgePass(userID))
|
return client.Login(address, s.t.getUserBridgePass(userID))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *scenario) userConnectsAndCanNotAuthenticateIMAPClientWithAddress(username, clientID, address string) error {
|
||||||
|
if err := s.t.newIMAPClient(s.t.getUserID(username), clientID); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
userID, client := s.t.getIMAPClient(clientID)
|
||||||
|
|
||||||
|
if err := client.Login(address, s.t.getUserBridgePass(userID)); err == nil {
|
||||||
|
return fmt.Errorf("expected error, got nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *scenario) imapClientCanAuthenticate(clientID string) error {
|
func (s *scenario) imapClientCanAuthenticate(clientID string) error {
|
||||||
userID, client := s.t.getIMAPClient(clientID)
|
userID, client := s.t.getIMAPClient(clientID)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user