Exemplo n.º 1
0
        public void CanGetAuthorization()
        {
            var auth = new AuthHandler(new DictCache <Authorization>());

            auth.Login(Registry.DockerHub);

            string scope = "repository:library/ubuntu:pull";

            Assert.IsNull(auth.GetAuthorization(scope));
            Assert.IsTrue(auth.UpdateAuthorization(scope));
            Assert.IsNotNull(auth.GetAuthorization(scope));
        }
Exemplo n.º 2
0
        public void CanHandleFailedAuthorization()
        {
            var auth = new AuthHandler(new DictCache <Authorization>());

            auth.Login(Registry.DockerHub);

            string scope = "registry:catalog:*";

            Assert.IsNull(auth.GetAuthorization(scope));
            Assert.IsFalse(auth.UpdateAuthorization(scope));
            Assert.IsNull(auth.GetAuthorization(scope));
        }