diff --git a/go.mod b/go.mod index 6956de98..0a9efeef 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 4e0d80d6..1eb2a82a 100644 --- a/go.sum +++ b/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-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= diff --git a/tests/bdd_test.go b/tests/bdd_test.go index a2f3216a..816eafc9 100644 --- a/tests/bdd_test.go +++ b/tests/bdd_test.go @@ -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 }) diff --git a/tests/ctx_reporter_test.go b/tests/ctx_reporter_test.go index 7a248489..83c9da5f 100644 --- a/tests/ctx_reporter_test.go +++ b/tests/ctx_reporter_test.go @@ -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 . + package tests import ( diff --git a/tests/ctx_test.go b/tests/ctx_test.go index 9fe7196d..32551265 100644 --- a/tests/ctx_test.go +++ b/tests/ctx_test.go @@ -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 { diff --git a/tests/features/imap/message/drafts.feature b/tests/features/imap/message/drafts.feature index b5dc9532..fd1b2168 100644 --- a/tests/features/imap/message/drafts.feature +++ b/tests/features/imap/message/drafts.feature @@ -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 | + | to | subject | body | + | 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 | + | to | subject | body | + | 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 | + | to | subject | body | + | someone@example.com | Basic Draft | This is a draft body, but longer | And IMAP client "1" sees 1 messages in "Drafts"