apupier commented on code in PR #8364: URL: https://github.com/apache/camel-quarkus/pull/8364#discussion_r2873321838
########## integration-tests/qdrant/src/test/java/org/apache/camel/quarkus/component/qdrant/it/QdrantAuthTest.java: ########## @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.qdrant.it; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.containsString; + +@QuarkusTestResource(QdrantAuthTestResource.class) +@QuarkusTest +class QdrantAuthTest { + + @Test + void apiKeyAuthenticationShouldWork() { + RestAssured.put("/qdrant/apiKey/valid") + .then() + .statusCode(200) + .body(containsString("ApiKeyCredentials reflection works")); + } + + @Test + void invalidApiKeyShouldBeRejected() { + // Verify that authentication is actually enforced with wrong API key + RestAssured.put("/qdrant/apiKey/invalid") + .then() + .statusCode(200) + .body(containsString("Authentication correctly failed")); + } Review Comment: at first read, I was wondering why there is a status code 200 when the api key is invalid, but given it s relatively specific use case, I'm not sure we can write it in a better way, I mean having the 403 or something like that as i'm not sure it is surfacing up from the underlying calls. Just a note that it made me tick when reading it at first, in case you have a second thought on it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
