public void CanParseUriPathToScope() { var auth = new AuthHandler(new DictCache <Authorization>()); Assert.AreEqual("registry:catalog", auth.ParseScope(new Uri("https://myregistry.io/v2/_catalog"))); Assert.AreEqual("repository:coolimage", auth.ParseScope(new Uri("https://myregistry.io/v2/coolimage/tags/list"))); Assert.AreEqual("repository:cool/image", auth.ParseScope(new Uri("https://myregistry.io/v2/cool/image/manifests/latest"))); Assert.AreEqual("repository:super/cool/image", auth.ParseScope(new Uri("https://myregistry.io/v2/super/cool/image/blobs/sha256:digest"))); }
public void CanThrowOnBadUriPath() { var auth = new AuthHandler(new DictCache <Authorization>()); auth.ParseScope(new Uri("https://myregistry.io/something/else")); }
public void CanThrowOnBadUriPath() { var auth = new AuthHandler(new DictCache <Authorization>(), null, null); Assert.Throws <ArgumentException>(() => auth.ParseScope(new Uri("https://myregistry.io/something/else"))); }