use of org.cactoos.text.Base64Encoded in project artipie by artipie.
the class AuthAndPermissionsTest method johnCanDelete.
@Test
void johnCanDelete() throws IOException {
final RsStatus status = RsStatus.NO_CONTENT;
MatcherAssert.assertThat(new BasicAuthSlice(new SliceSimple(new RsWithStatus(status)), new AuthFromYaml(this.credentials()), new Permission.ByName("delete", this.permissions())).response(new RequestLine("PUT", "/foo", "HTTP/1.2").toString(), new ListOf<Map.Entry<String, String>>(new Authorization(String.format("Basic %s", new Base64Encoded("john:123").asString()))), Flowable.empty()), new RsHasStatus(status));
}
use of org.cactoos.text.Base64Encoded in project artipie by artipie.
the class AuthAndPermissionsTest method publicRepoWorksWithAuth.
@Test
void publicRepoWorksWithAuth() throws IOException {
final RsStatus status = RsStatus.OK;
MatcherAssert.assertThat(new BasicAuthSlice(new SliceSimple(new RsWithStatus(status)), new AuthFromYaml(this.credentials()), new Permission.ByName("delete", this.allAllowedPermissions())).response(new RequestLine("GET", "/foo", "HTTP/1.2").toString(), new ListOf<Map.Entry<String, String>>(new Authorization(String.format("Basic %s", new Base64Encoded("admin:abc").asString()))), Flowable.empty()), new RsHasStatus(status));
}
use of org.cactoos.text.Base64Encoded in project artipie by artipie.
the class AuthAndPermissionsTest method adminCanDeploy.
@Test
void adminCanDeploy() throws IOException {
final RsStatus status = RsStatus.ACCEPTED;
MatcherAssert.assertThat(new BasicAuthSlice(new SliceSimple(new RsWithStatus(status)), new AuthFromYaml(this.credentials()), new Permission.ByName("deploy", this.permissions())).response(new RequestLine("PUT", "/foo", "HTTP/1.2").toString(), new ListOf<Map.Entry<String, String>>(new Authorization(String.format("Basic %s", new Base64Encoded("admin:abc").asString()))), Flowable.empty()), new RsHasStatus(status));
}
use of org.cactoos.text.Base64Encoded in project artipie by artipie.
the class GemITCase method gemPushAndInstallWorks.
@Test
void gemPushAndInstallWorks() throws IOException {
this.containers.assertExec("Packages was not pushed", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(new ListOf<String>("POST http://artipie:8080/my-gem/api/v1/gems", "201 Created"))), "env", String.format("GEM_HOST_API_KEY=%s", new Base64Encoded("any:any").asString()), "gem", "push", "-v", "/w/rails-6.0.2.2.gem", "--host", "http://artipie:8080/my-gem");
this.containers.assertArtipieContent("Package was not added to storage", String.format("/var/artipie/data/my-gem/gems/%s", GemITCase.RAILS), new IsEqual<>(new TestResource(String.format("gem/%s", GemITCase.RAILS)).asBytes()));
this.containers.assertExec("rubygems.org was not removed from sources", new ContainerResultMatcher(), "gem", "sources", "--remove", "https://rubygems.org/");
this.containers.assertExec("Package was not installed", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(new ListOf<String>(String.format("GET http://artipie:8080/my-gem/quick/Marshal.4.8/%sspec.rz", GemITCase.RAILS), "200 OK", "Successfully installed rails-6.0.2.2", "1 gem installed"))), "gem", "install", GemITCase.RAILS, "--source", "http://artipie:8080/my-gem", "--ignore-dependencies", "-V");
}
Aggregations