GODT-2181(test): Linter fixes

This commit is contained in:
James Houlahan
2022-12-13 13:29:58 +01:00
parent 87ce5a6d82
commit 2ca9ca3cb6
6 changed files with 36 additions and 13 deletions

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/ProtonMail/gluon v0.14.2-0.20221207071431-0faa318d3c9f
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/gopenpgp/v2 v2.4.10
github.com/PuerkitoBio/goquery v1.8.0

2
go.sum
View File

@ -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-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.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/go.mod h1:6oOKr0jXvpoE6pwTx/HukigQpX2J9WUf6h0auplrFTw=
github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg=

View File

@ -24,7 +24,6 @@ import (
"testing"
"github.com/cucumber/godog"
"github.com/sirupsen/logrus"
)
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) {
logrus.Debugf("Running step: %s", st.Text)
s.t.beforeStep(st)
return ctx, nil
})
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
})

View File

@ -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
import (

View File

@ -156,8 +156,8 @@ func (t *testCtx) replace(value string) string {
})
// Replace [addr:EMAIL] with a unique address for the email EMAIL.
value = regexp.MustCompile(`\[addr:(\w+)\]`).ReplaceAllStringFunc(value, func(match string) string {
email := regexp.MustCompile(`\[addr:(\w+)\]`).FindStringSubmatch(match)[1]
value = regexp.MustCompile(`\[alias:(\w+)\]`).ReplaceAllStringFunc(value, func(match string) string {
email := regexp.MustCompile(`\[alias:(\w+)\]`).FindStringSubmatch(match)[1]
// Create a new address if it doesn't exist yet.
if _, ok := t.addrUUIDByName[email]; !ok {
@ -176,6 +176,8 @@ func (t *testCtx) replace(value string) string {
}
func (t *testCtx) beforeStep(st *godog.Step) {
logrus.Debugf("Running step: %s", st.Text)
t.callsLock.Lock()
defer t.callsLock.Unlock()
@ -186,6 +188,10 @@ func (t *testCtx) beforeStep(st *godog.Step) {
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 {
for name, userID := range t.userIDByName {
if userID == wantUserID {

View File

@ -24,22 +24,22 @@ Feature: IMAP Draft messages
"""
Subject: Basic Draft
Content-Type: text/plain
To: someone@proton.me
To: someone@example.com
This is a draft, but longer
"""
Then it succeeds
And IMAP client "1" eventually sees the following messages in "Drafts":
| 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"
Scenario: Draft edited remotely
When the following fields were changed in draft 1 for address "[user:user]@[domain]" of account "[user:user]":
| 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":
| 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"