mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 20:56:51 +00:00
fix(GODT-2753): vault test now check that value auto-assigned is first available port.
This commit is contained in:
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/ProtonMail/proton-bridge/v3/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v3/internal/updater"
|
||||||
"github.com/ProtonMail/proton-bridge/v3/internal/useragent"
|
"github.com/ProtonMail/proton-bridge/v3/internal/useragent"
|
||||||
"github.com/ProtonMail/proton-bridge/v3/internal/vault"
|
"github.com/ProtonMail/proton-bridge/v3/internal/vault"
|
||||||
|
"github.com/ProtonMail/proton-bridge/v3/pkg/ports"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ func TestVault_Settings_IMAP(t *testing.T) {
|
|||||||
s := newVault(t)
|
s := newVault(t)
|
||||||
|
|
||||||
// Check the default IMAP port and SSL setting.
|
// Check the default IMAP port and SSL setting.
|
||||||
require.Equal(t, 1143, s.GetIMAPPort())
|
require.Equal(t, ports.FindFreePortFrom(1143), s.GetIMAPPort())
|
||||||
require.Equal(t, false, s.GetIMAPSSL())
|
require.Equal(t, false, s.GetIMAPSSL())
|
||||||
|
|
||||||
// Modify the IMAP port and SSL setting.
|
// Modify the IMAP port and SSL setting.
|
||||||
@ -51,7 +52,7 @@ func TestVault_Settings_SMTP(t *testing.T) {
|
|||||||
s := newVault(t)
|
s := newVault(t)
|
||||||
|
|
||||||
// Check the default SMTP port and SSL setting.
|
// Check the default SMTP port and SSL setting.
|
||||||
require.Equal(t, 1025, s.GetSMTPPort())
|
require.Equal(t, ports.FindFreePortFrom(1025), s.GetSMTPPort())
|
||||||
require.Equal(t, false, s.GetSMTPSSL())
|
require.Equal(t, false, s.GetSMTPSSL())
|
||||||
|
|
||||||
// Modify the SMTP port and SSL setting.
|
// Modify the SMTP port and SSL setting.
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ProtonMail/gluon/async"
|
"github.com/ProtonMail/gluon/async"
|
||||||
"github.com/ProtonMail/proton-bridge/v3/internal/vault"
|
"github.com/ProtonMail/proton-bridge/v3/internal/vault"
|
||||||
|
"github.com/ProtonMail/proton-bridge/v3/pkg/ports"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -93,8 +94,8 @@ func TestVault_Reset(t *testing.T) {
|
|||||||
require.NoError(t, s.Reset(s.GetGluonCacheDir()))
|
require.NoError(t, s.Reset(s.GetGluonCacheDir()))
|
||||||
|
|
||||||
// The data is gone.
|
// The data is gone.
|
||||||
require.Equal(t, 1143, s.GetIMAPPort())
|
require.Equal(t, ports.FindFreePortFrom(1143), s.GetIMAPPort())
|
||||||
require.Equal(t, 1025, s.GetSMTPPort())
|
require.Equal(t, ports.FindFreePortFrom(1025), s.GetSMTPPort())
|
||||||
}
|
}
|
||||||
|
|
||||||
func newVault(t *testing.T) *vault.Vault {
|
func newVault(t *testing.T) *vault.Vault {
|
||||||
|
|||||||
Reference in New Issue
Block a user