Add challenge unmarshal test cases.
This commit is contained in:
parent
b8208ec401
commit
6b5a2b17b5
1 changed files with 27 additions and 1 deletions
|
@ -433,7 +433,7 @@ func TestChallengeUnmarshal(t *testing.T) {
|
|||
err: ServerInternalErr(errors.New("error unmarshaling challenge type: unexpected end of JSON input")),
|
||||
}
|
||||
},
|
||||
"fail/unexpected-type": func(t *testing.T) test {
|
||||
"fail/unexpected-type-http": func(t *testing.T) test {
|
||||
httpCh, err := newHTTPCh()
|
||||
assert.FatalError(t, err)
|
||||
_httpCh, ok := httpCh.(*http01Challenge)
|
||||
|
@ -446,6 +446,32 @@ func TestChallengeUnmarshal(t *testing.T) {
|
|||
err: ServerInternalErr(errors.New("unexpected challenge type foo")),
|
||||
}
|
||||
},
|
||||
"fail/unexpected-type-alpn": func(t *testing.T) test {
|
||||
tlsALPNCh, err := newTLSALPNCh()
|
||||
assert.FatalError(t, err)
|
||||
_tlsALPNCh, ok := tlsALPNCh.(*tlsALPN01Challenge)
|
||||
assert.Fatal(t, ok)
|
||||
_tlsALPNCh.baseChallenge.Type = "foo"
|
||||
b, err := json.Marshal(tlsALPNCh)
|
||||
assert.FatalError(t, err)
|
||||
return test{
|
||||
chb: b,
|
||||
err: ServerInternalErr(errors.New("unexpected challenge type foo")),
|
||||
}
|
||||
},
|
||||
"fail/unexpected-type-dns": func(t *testing.T) test {
|
||||
dnsCh, err := newDNSCh()
|
||||
assert.FatalError(t, err)
|
||||
_tlsALPNCh, ok := dnsCh.(*dns01Challenge)
|
||||
assert.Fatal(t, ok)
|
||||
_tlsALPNCh.baseChallenge.Type = "foo"
|
||||
b, err := json.Marshal(dnsCh)
|
||||
assert.FatalError(t, err)
|
||||
return test{
|
||||
chb: b,
|
||||
err: ServerInternalErr(errors.New("unexpected challenge type foo")),
|
||||
}
|
||||
},
|
||||
"ok/dns": func(t *testing.T) test {
|
||||
dnsCh, err := newDNSCh()
|
||||
assert.FatalError(t, err)
|
||||
|
|
Loading…
Reference in a new issue