mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-08 00:33:00 +03:00
Pull request: 4898-redirect-https
Merge in DNS/adguard-home from 4898-redirect-https to master
Updates #4898.
Updates #4927.
Squashed commit of the following:
commit bc41b6cae7ede0f1235e3956ab49204af1c9f38d
Merge: 815e2991 ac7634da
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Nov 1 13:02:23 2022 +0300
Merge branch 'master' into 4898-redirect-https
commit 815e299137224fc3c7fd46924d7b936515b95d67
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Tue Nov 1 12:58:28 2022 +0300
home: imp ip addr detection
commit 9d4ecd9ab0e13ef6c19c3b923363bff43394ea4c
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Oct 31 17:23:41 2022 +0300
home: imp cyclo
commit 86c47b68fe6e3916cec97eee5d34e3e6c18e4892
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Oct 31 15:06:05 2022 +0300
all: imp text
commit bcc25697b551668d1dab53a874e716fcadd83f09
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Oct 31 11:47:57 2022 +0300
home: fix test
commit bb51a74cb82eeaa977821fa7314810c7b8be55cb
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Sun Oct 30 23:23:40 2022 +0300
home: imp code
commit 38522330691baf8475a59ed4f40b1d45363df1e3
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Fri Oct 28 17:00:50 2022 +0300
home: imp code
commit 7284f7288feb7491560f0f5d2754044c7a9f603a
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Oct 27 19:42:57 2022 +0300
all: log changes
commit 540efcb013e15294b98efe581323f75ceefc8f5a
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Oct 27 19:24:21 2022 +0300
home: imp tls
This commit is contained in:
parent
ac7634da37
commit
c5565a9e4e
3 changed files with 115 additions and 112 deletions
internal/home
|
@ -4,6 +4,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/golibs/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -43,8 +44,7 @@ func TestValidateCertificates(t *testing.T) {
|
|||
t.Run("bad_certificate", func(t *testing.T) {
|
||||
status := &tlsConfigStatus{}
|
||||
err := validateCertificates(status, []byte("bad cert"), nil, "")
|
||||
assert.Error(t, err)
|
||||
assert.NotEmpty(t, status.WarningValidation)
|
||||
testutil.AssertErrorMsg(t, "empty certificate", err)
|
||||
assert.False(t, status.ValidCert)
|
||||
assert.False(t, status.ValidChain)
|
||||
})
|
||||
|
@ -52,20 +52,18 @@ func TestValidateCertificates(t *testing.T) {
|
|||
t.Run("bad_private_key", func(t *testing.T) {
|
||||
status := &tlsConfigStatus{}
|
||||
err := validateCertificates(status, nil, []byte("bad priv key"), "")
|
||||
assert.Error(t, err)
|
||||
assert.NotEmpty(t, status.WarningValidation)
|
||||
testutil.AssertErrorMsg(t, "no valid keys were found", err)
|
||||
assert.False(t, status.ValidKey)
|
||||
})
|
||||
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
status := &tlsConfigStatus{}
|
||||
err := validateCertificates(status, testCertChainData, testPrivateKeyData, "")
|
||||
assert.NoError(t, err)
|
||||
assert.Error(t, err)
|
||||
|
||||
notBefore := time.Date(2019, 2, 27, 9, 24, 23, 0, time.UTC)
|
||||
notAfter := time.Date(2046, 7, 14, 9, 24, 23, 0, time.UTC)
|
||||
|
||||
assert.NotEmpty(t, status.WarningValidation)
|
||||
assert.True(t, status.ValidCert)
|
||||
assert.False(t, status.ValidChain)
|
||||
assert.True(t, status.ValidKey)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue