Add new property to switch the proxy auth configuration
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package de.extio.lmlib.client;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ProxyAuthorizationSupportTest {
|
||||
|
||||
@Test
|
||||
void httpClientModeIsDefault() {
|
||||
final var support = new ProxyAuthorizationSupport(ProxyAuthorizationSupport.MODE_HTTP_CLIENT, "login", "password");
|
||||
assertTrue(support.isHttpClientMode());
|
||||
assertFalse(support.isHeaderMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void headerModeIsEnabled() {
|
||||
final var support = new ProxyAuthorizationSupport(ProxyAuthorizationSupport.MODE_HEADER, "login", "password");
|
||||
assertTrue(support.isHeaderMode());
|
||||
assertFalse(support.isHttpClientMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void encodesCredentials() {
|
||||
assertEquals("bG9naW46cGFzc3dvcmQ=", ProxyAuthorizationSupport.encodeCredentials("login", "password"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
import de.extio.lmlib.client.ProxyAuthorizationSupport;
|
||||
import de.extio.lmlib.profile.ModelCategory;
|
||||
import de.extio.lmlib.profile.ModelProfileService;
|
||||
|
||||
@@ -71,7 +72,7 @@ public class TokenizerTest {
|
||||
@Disabled("Requires llama.cpp model profile")
|
||||
@Test
|
||||
void llamaServer() throws Exception {
|
||||
final var tokenizer = new LlamaServerTokenizer(this.restClientBuilder);
|
||||
final var tokenizer = new LlamaServerTokenizer(this.restClientBuilder, new ProxyAuthorizationSupport(ProxyAuthorizationSupport.MODE_HTTP_CLIENT, "", ""));
|
||||
final var profile = this.modelProfileService.getModelProfile(ModelCategory.MEDIUM.getModelProfile());
|
||||
|
||||
assertEquals(21, tokenizer.count(TEXT, profile));
|
||||
|
||||
Reference in New Issue
Block a user