use of com.artipie.http.rq.RequestLine in project artipie by artipie.
the class DockerProxyTest method shouldBuildFromConfig.
@ParameterizedTest
@MethodSource("goodConfigs")
void shouldBuildFromConfig(final String yaml) throws Exception {
final Slice slice = dockerProxy(yaml);
MatcherAssert.assertThat(slice.response(new RequestLine(RqMethod.GET, "/").toString(), Headers.EMPTY, Flowable.empty()), new RsHasStatus(new IsNot<>(new CustomMatcher<>("is server error") {
@Override
public boolean matches(final Object item) {
return ((RsStatus) item).serverError();
}
})));
}
use of com.artipie.http.rq.RequestLine in project artipie by artipie.
the class DockerProxyTest method shouldFailBuildFromBadConfig.
@ParameterizedTest
@MethodSource("badConfigs")
void shouldFailBuildFromBadConfig(final String yaml) throws Exception {
final Slice slice = dockerProxy(yaml);
Assertions.assertThrows(RuntimeException.class, () -> slice.response(new RequestLine(RqMethod.GET, "/").toString(), Headers.EMPTY, Flowable.empty()).send((status, headers, body) -> CompletableFuture.allOf()).toCompletableFuture().join());
}
use of com.artipie.http.rq.RequestLine 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 com.artipie.http.rq.RequestLine 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 com.artipie.http.rq.RequestLine in project artipie by artipie.
the class AuthAndPermissionsTest method authIsNotRequiredForPublicRepo.
@Test
void authIsNotRequiredForPublicRepo() {
final RsStatus status = RsStatus.ACCEPTED;
MatcherAssert.assertThat(new BasicAuthSlice(new SliceSimple(new RsWithStatus(status)), new AuthFromYaml(this.credentials()), new Permission.ByName("install", this.allAllowedPermissions())).response(new RequestLine("GET", "/foo", "HTTP/1.2").toString(), Collections.emptyList(), Flowable.empty()), new RsHasStatus(status));
}
Aggregations