Fix test failures in core

This commit is contained in:
Richard Barnes 2015-07-29 14:40:41 -04:00
parent 76a2e15958
commit 08c86e560e
3 changed files with 12 additions and 4 deletions

View File

@ -82,17 +82,20 @@ func TestMergeChallenge(t *testing.T) {
t1 := time.Now() t1 := time.Now()
t2 := time.Now().Add(-5 * time.Hour) t2 := time.Now().Add(-5 * time.Hour)
challenge := Challenge{ challenge := Challenge{
Type: ChallengeTypeSimpleHTTP,
Status: StatusPending, Status: StatusPending,
Validated: &t1, Validated: &t1,
Token: "asdf", Token: "asdf",
} }
response := Challenge{ response := Challenge{
Type: ChallengeTypeSimpleHTTP,
Status: StatusValid, Status: StatusValid,
Validated: &t2, Validated: &t2,
Token: "qwer", Token: "qwer",
TLS: &tls, TLS: &tls,
} }
merged := Challenge{ merged := Challenge{
Type: ChallengeTypeSimpleHTTP,
Status: StatusPending, Status: StatusPending,
Validated: &t1, Validated: &t1,
Token: "asdf", Token: "asdf",

View File

@ -15,7 +15,7 @@ import (
"strings" "strings"
"time" "time"
jose "github.com/letsencrypt/boulder/Godeps/_workspace/src/github.com/letsencrypt/go-jose" "github.com/letsencrypt/boulder/Godeps/_workspace/src/github.com/letsencrypt/go-jose"
) )
// AcmeStatus defines the state of a given authorization // AcmeStatus defines the state of a given authorization
@ -75,7 +75,10 @@ const (
ChallengeTypeDNS = "dns" ChallengeTypeDNS = "dns"
) )
// The suffix appended to pseudo-domain names in DVSNI challenges
const DVSNISuffix = "acme.invalid" const DVSNISuffix = "acme.invalid"
// The label attached to DNS names in DNS challenges
const DNSPrefix = "_acme-challenge" const DNSPrefix = "_acme-challenge"
func (pd *ProblemDetails) Error() string { func (pd *ProblemDetails) Error() string {
@ -311,9 +314,9 @@ func (ch Challenge) MergeResponse(resp Challenge) Challenge {
*ch.TLS = true *ch.TLS = true
} }
case DVSNI: case ChallengeTypeDVSNI:
fallthrough fallthrough
case DNS: case ChallengeTypeDNS:
// For dvsni and dns, only "validation" is client-provided // For dvsni and dns, only "validation" is client-provided
if resp.Validation != nil { if resp.Validation != nil {
ch.Validation = resp.Validation ch.Validation = resp.Validation

View File

@ -10,6 +10,8 @@ import (
"net/url" "net/url"
"testing" "testing"
"github.com/letsencrypt/boulder/Godeps/_workspace/src/github.com/letsencrypt/go-jose"
"github.com/letsencrypt/boulder/test" "github.com/letsencrypt/boulder/test"
) )
@ -60,7 +62,7 @@ func TestSanityCheck(t *testing.T) {
chall.TLS = &tls chall.TLS = &tls
test.Assert(t, chall.IsSane(false), "IsSane should be true") test.Assert(t, chall.IsSane(false), "IsSane should be true")
} else if challengeType == ChallengeTypeDVSNI || challengeType == ChallengeTypeDNS { } else if challengeType == ChallengeTypeDVSNI || challengeType == ChallengeTypeDNS {
chall.Validation = new(AcmeJWS) chall.Validation = new(jose.JsonWebSignature)
test.Assert(t, chall.IsSane(true), "IsSane should be true") test.Assert(t, chall.IsSane(true), "IsSane should be true")
} }
} }