Skip to content

Commit

Permalink
Added IPv6 testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
joohoi committed Dec 4, 2016
1 parent ad4decb commit 8ddb845
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ func TestApiManyUpdateWithIpCheckHeaders(t *testing.T) {
t.Errorf("Could not create new user with CIDR, got error [%v]", err)
}

newUserWithIP6CIDR, err := DB.Register(cidrslice{"2002:c0a8::0/32"})
if err != nil {
t.Errorf("Could not create a new user with IP6 CIDR, got error [%v]", err)
}

for _, test := range []struct {
user ACMETxt
headerValue string
Expand All @@ -238,6 +243,9 @@ func TestApiManyUpdateWithIpCheckHeaders(t *testing.T) {
{newUserWithCIDR, "127.0.0.1", 401},
{newUserWithCIDR, "10.0.0.1, 10.0.0.2, 192.168.1.3", 401},
{newUserWithCIDR, "10.1.1.1 ,192.168.1.2, 8.8.8.8", 200},
{newUserWithIP6CIDR, "2002:c0a8:b4dc:0d3::0", 200},
{newUserWithIP6CIDR, "2002:c0a7:0ff::0", 401},
{newUserWithIP6CIDR, "2002:c0a8:d3ad:b33f:c0ff:33b4:dc0d:3b4d", 200},
} {
updateJSON = map[string]interface{}{
"subdomain": test.user.Subdomain,
Expand Down
1 change: 1 addition & 0 deletions validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func TestGetValidCIDRMasks(t *testing.T) {
}{
{cidrslice{"10.0.0.1/24"}, cidrslice{"10.0.0.1/24"}},
{cidrslice{"invalid", "127.0.0.1/32"}, cidrslice{"127.0.0.1/32"}},
{cidrslice{"2002:c0a8::0/32", "8.8.8.8/32"}, cidrslice{"2002:c0a8::0/32", "8.8.8.8/32"}},
} {
ret := test.input.ValidEntries()
if len(ret) == len(test.output) {
Expand Down

0 comments on commit 8ddb845

Please sign in to comment.