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()
t2 := time.Now().Add(-5 * time.Hour)
challenge := Challenge{
Type: ChallengeTypeSimpleHTTP,
Status: StatusPending,
Validated: &t1,
Token: "asdf",
}
response := Challenge{
Type: ChallengeTypeSimpleHTTP,
Status: StatusValid,
Validated: &t2,
Token: "qwer",
TLS: &tls,
}
merged := Challenge{
Type: ChallengeTypeSimpleHTTP,
Status: StatusPending,
Validated: &t1,
Token: "asdf",

View File

@ -15,7 +15,7 @@ import (
"strings"
"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
@ -75,7 +75,10 @@ const (
ChallengeTypeDNS = "dns"
)
// The suffix appended to pseudo-domain names in DVSNI challenges
const DVSNISuffix = "acme.invalid"
// The label attached to DNS names in DNS challenges
const DNSPrefix = "_acme-challenge"
func (pd *ProblemDetails) Error() string {
@ -311,9 +314,9 @@ func (ch Challenge) MergeResponse(resp Challenge) Challenge {
*ch.TLS = true
}
case DVSNI:
case ChallengeTypeDVSNI:
fallthrough
case DNS:
case ChallengeTypeDNS:
// For dvsni and dns, only "validation" is client-provided
if resp.Validation != nil {
ch.Validation = resp.Validation

View File

@ -10,6 +10,8 @@ import (
"net/url"
"testing"
"github.com/letsencrypt/boulder/Godeps/_workspace/src/github.com/letsencrypt/go-jose"
"github.com/letsencrypt/boulder/test"
)
@ -60,7 +62,7 @@ func TestSanityCheck(t *testing.T) {
chall.TLS = &tls
test.Assert(t, chall.IsSane(false), "IsSane should be true")
} 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")
}
}