forked from Silverfish/proton-bridge
GODT-2181(test): Linter fixes
This commit is contained in:
2
go.mod
2
go.mod
@ -7,7 +7,7 @@ require (
|
|||||||
github.com/Masterminds/semver/v3 v3.1.1
|
github.com/Masterminds/semver/v3 v3.1.1
|
||||||
github.com/ProtonMail/gluon v0.14.2-0.20221207071431-0faa318d3c9f
|
github.com/ProtonMail/gluon v0.14.2-0.20221207071431-0faa318d3c9f
|
||||||
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a
|
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a
|
||||||
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213042823-5bfe853434e7
|
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213121236-3439b3eda101
|
||||||
github.com/ProtonMail/go-rfc5322 v0.11.0
|
github.com/ProtonMail/go-rfc5322 v0.11.0
|
||||||
github.com/ProtonMail/gopenpgp/v2 v2.4.10
|
github.com/ProtonMail/gopenpgp/v2 v2.4.10
|
||||||
github.com/PuerkitoBio/goquery v1.8.0
|
github.com/PuerkitoBio/goquery v1.8.0
|
||||||
|
|||||||
2
go.sum
2
go.sum
@ -45,6 +45,8 @@ github.com/ProtonMail/go-mime v0.0.0-20220429130430-2192574d760f h1:4IWzKjHzZxdr
|
|||||||
github.com/ProtonMail/go-mime v0.0.0-20220429130430-2192574d760f/go.mod h1:qRZgbeASl2a9OwmsV85aWwRqic0NHPh+9ewGAzb4cgM=
|
github.com/ProtonMail/go-mime v0.0.0-20220429130430-2192574d760f/go.mod h1:qRZgbeASl2a9OwmsV85aWwRqic0NHPh+9ewGAzb4cgM=
|
||||||
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213042823-5bfe853434e7 h1:jreVsSvIlslQpDks/OhEL1YyI1XBmhgzYDdoQ9u68UA=
|
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213042823-5bfe853434e7 h1:jreVsSvIlslQpDks/OhEL1YyI1XBmhgzYDdoQ9u68UA=
|
||||||
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213042823-5bfe853434e7/go.mod h1:O7ZTIDOhJRkfQgtW8dB0ZSCq8OZsShjMQ3ahzpDheOk=
|
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213042823-5bfe853434e7/go.mod h1:O7ZTIDOhJRkfQgtW8dB0ZSCq8OZsShjMQ3ahzpDheOk=
|
||||||
|
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213121236-3439b3eda101 h1:3VvTdvETVVRYoiTj6GHaAiLUD1DQp72wbeQAQdw9lIY=
|
||||||
|
github.com/ProtonMail/go-proton-api v0.2.2-0.20221213121236-3439b3eda101/go.mod h1:JUo5IQG0hNuPRuDpOUsCOvtee6UjTEHHF1QN2i8RSos=
|
||||||
github.com/ProtonMail/go-rfc5322 v0.11.0 h1:o5Obrm4DpmQEffvgsVqG6S4BKwC1Wat+hYwjIp2YcCY=
|
github.com/ProtonMail/go-rfc5322 v0.11.0 h1:o5Obrm4DpmQEffvgsVqG6S4BKwC1Wat+hYwjIp2YcCY=
|
||||||
github.com/ProtonMail/go-rfc5322 v0.11.0/go.mod h1:6oOKr0jXvpoE6pwTx/HukigQpX2J9WUf6h0auplrFTw=
|
github.com/ProtonMail/go-rfc5322 v0.11.0/go.mod h1:6oOKr0jXvpoE6pwTx/HukigQpX2J9WUf6h0auplrFTw=
|
||||||
github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg=
|
github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg=
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/cucumber/godog"
|
"github.com/cucumber/godog"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type scenario struct {
|
type scenario struct {
|
||||||
@ -89,13 +88,12 @@ func TestFeatures(testingT *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
ctx.StepContext().Before(func(ctx context.Context, st *godog.Step) (context.Context, error) {
|
ctx.StepContext().Before(func(ctx context.Context, st *godog.Step) (context.Context, error) {
|
||||||
logrus.Debugf("Running step: %s", st.Text)
|
|
||||||
s.t.beforeStep(st)
|
s.t.beforeStep(st)
|
||||||
return ctx, nil
|
return ctx, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.StepContext().After(func(ctx context.Context, st *godog.Step, status godog.StepResultStatus, _ error) (context.Context, error) {
|
ctx.StepContext().After(func(ctx context.Context, st *godog.Step, status godog.StepResultStatus, _ error) (context.Context, error) {
|
||||||
logrus.Debugf("Finished step (%v): %s", status, st.Text)
|
s.t.afterStep(st, status)
|
||||||
return ctx, nil
|
return ctx, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,20 @@
|
|||||||
|
// Copyright (c) 2022 Proton AG
|
||||||
|
//
|
||||||
|
// This file is part of Proton Mail Bridge.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package tests
|
package tests
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@ -156,8 +156,8 @@ func (t *testCtx) replace(value string) string {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Replace [addr:EMAIL] with a unique address for the email EMAIL.
|
// Replace [addr:EMAIL] with a unique address for the email EMAIL.
|
||||||
value = regexp.MustCompile(`\[addr:(\w+)\]`).ReplaceAllStringFunc(value, func(match string) string {
|
value = regexp.MustCompile(`\[alias:(\w+)\]`).ReplaceAllStringFunc(value, func(match string) string {
|
||||||
email := regexp.MustCompile(`\[addr:(\w+)\]`).FindStringSubmatch(match)[1]
|
email := regexp.MustCompile(`\[alias:(\w+)\]`).FindStringSubmatch(match)[1]
|
||||||
|
|
||||||
// Create a new address if it doesn't exist yet.
|
// Create a new address if it doesn't exist yet.
|
||||||
if _, ok := t.addrUUIDByName[email]; !ok {
|
if _, ok := t.addrUUIDByName[email]; !ok {
|
||||||
@ -176,6 +176,8 @@ func (t *testCtx) replace(value string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *testCtx) beforeStep(st *godog.Step) {
|
func (t *testCtx) beforeStep(st *godog.Step) {
|
||||||
|
logrus.Debugf("Running step: %s", st.Text)
|
||||||
|
|
||||||
t.callsLock.Lock()
|
t.callsLock.Lock()
|
||||||
defer t.callsLock.Unlock()
|
defer t.callsLock.Unlock()
|
||||||
|
|
||||||
@ -186,6 +188,10 @@ func (t *testCtx) beforeStep(st *godog.Step) {
|
|||||||
t.errors = append(t.errors, nil)
|
t.errors = append(t.errors, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *testCtx) afterStep(st *godog.Step, status godog.StepResultStatus) {
|
||||||
|
logrus.Debugf("Finished step (%v): %s", status, st.Text)
|
||||||
|
}
|
||||||
|
|
||||||
func (t *testCtx) getName(wantUserID string) string {
|
func (t *testCtx) getName(wantUserID string) string {
|
||||||
for name, userID := range t.userIDByName {
|
for name, userID := range t.userIDByName {
|
||||||
if userID == wantUserID {
|
if userID == wantUserID {
|
||||||
|
|||||||
@ -24,22 +24,22 @@ Feature: IMAP Draft messages
|
|||||||
"""
|
"""
|
||||||
Subject: Basic Draft
|
Subject: Basic Draft
|
||||||
Content-Type: text/plain
|
Content-Type: text/plain
|
||||||
To: someone@proton.me
|
To: someone@example.com
|
||||||
|
|
||||||
This is a draft, but longer
|
This is a draft, but longer
|
||||||
"""
|
"""
|
||||||
Then it succeeds
|
Then it succeeds
|
||||||
And IMAP client "1" eventually sees the following messages in "Drafts":
|
And IMAP client "1" eventually sees the following messages in "Drafts":
|
||||||
| to | subject | body |
|
| to | subject | body |
|
||||||
| someone@proton.me | Basic Draft | This is a draft, but longer |
|
| someone@example.com | Basic Draft | This is a draft, but longer |
|
||||||
And IMAP client "1" sees 1 messages in "Drafts"
|
And IMAP client "1" sees 1 messages in "Drafts"
|
||||||
|
|
||||||
Scenario: Draft edited remotely
|
Scenario: Draft edited remotely
|
||||||
When the following fields were changed in draft 1 for address "[user:user]@[domain]" of account "[user:user]":
|
When the following fields were changed in draft 1 for address "[user:user]@[domain]" of account "[user:user]":
|
||||||
| to | subject | body |
|
| to | subject | body |
|
||||||
| someone@proton.me | Basic Draft | This is a draft body, but longer |
|
| someone@example.com | Basic Draft | This is a draft body, but longer |
|
||||||
Then IMAP client "1" eventually sees the following messages in "Drafts":
|
Then IMAP client "1" eventually sees the following messages in "Drafts":
|
||||||
| to | subject | body |
|
| to | subject | body |
|
||||||
| someone@proton.me | Basic Draft | This is a draft body, but longer |
|
| someone@example.com | Basic Draft | This is a draft body, but longer |
|
||||||
And IMAP client "1" sees 1 messages in "Drafts"
|
And IMAP client "1" sees 1 messages in "Drafts"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user