|
|
@ -2,13 +2,14 @@ package auth_test
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"github.com/containrrr/watchtower/internal/actions/mocks"
|
|
|
|
|
|
|
|
"github.com/containrrr/watchtower/pkg/registry/auth"
|
|
|
|
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/containrrr/watchtower/internal/actions/mocks"
|
|
|
|
|
|
|
|
"github.com/containrrr/watchtower/pkg/registry/auth"
|
|
|
|
|
|
|
|
|
|
|
|
wtTypes "github.com/containrrr/watchtower/pkg/types"
|
|
|
|
wtTypes "github.com/containrrr/watchtower/pkg/types"
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
@ -79,6 +80,18 @@ var _ = Describe("the auth module", func() {
|
|
|
|
Expect(err).To(HaveOccurred())
|
|
|
|
Expect(err).To(HaveOccurred())
|
|
|
|
Expect(res).To(BeNil())
|
|
|
|
Expect(res).To(BeNil())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
It("should not crash when an empty field is recieved", func() {
|
|
|
|
|
|
|
|
input := `bearer realm="https://ghcr.io/token",service="ghcr.io",scope="repository:user/image:pull",`
|
|
|
|
|
|
|
|
res, err := auth.GetAuthURL(input, "containrrr/watchtower")
|
|
|
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
|
|
|
Expect(res).NotTo(BeNil())
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
It("should not crash when a field without a value is recieved", func() {
|
|
|
|
|
|
|
|
input := `bearer realm="https://ghcr.io/token",service="ghcr.io",scope="repository:user/image:pull",valuelesskey`
|
|
|
|
|
|
|
|
res, err := auth.GetAuthURL(input, "containrrr/watchtower")
|
|
|
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
|
|
|
Expect(res).NotTo(BeNil())
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
When("getting a challenge url", func() {
|
|
|
|
When("getting a challenge url", func() {
|
|
|
|
It("should create a valid challenge url object based on the image ref supplied", func() {
|
|
|
|
It("should create a valid challenge url object based on the image ref supplied", func() {
|
|
|
|