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)); }
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)); }