Compare commits
No commits in common. "ea2d1a86ba08a34314b375457a2a1ac07a6d7179" and "9d46ca252664c3b7e6e91b47489eeb5ccf50143f" have entirely different histories.
ea2d1a86ba
...
9d46ca2526
2 changed files with 5 additions and 19 deletions
|
@ -47,16 +47,11 @@ class Gemini2Test : LocalProperties() {
|
||||||
@DisplayName("Chat Tests")
|
@DisplayName("Chat Tests")
|
||||||
inner class ChatTests {
|
inner class ChatTests {
|
||||||
private val apiKey = getProperty(Gemini2.GEMINI_API_KEY)
|
private val apiKey = getProperty(Gemini2.GEMINI_API_KEY)
|
||||||
|
private val maxTokens = getProperty(Gemini2.MAX_TOKENS_PROP).toInt()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisableOnCi
|
@DisableOnCi
|
||||||
fun chatHttpRequestInJavascript() {
|
fun chatHttpRequestInJavascript() {
|
||||||
val maxTokens = try {
|
|
||||||
getProperty(Gemini2.MAX_TOKENS_PROP).toInt()
|
|
||||||
} catch (_: NumberFormatException) {
|
|
||||||
1024
|
|
||||||
}
|
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
Gemini2.chat(
|
Gemini2.chat(
|
||||||
"javascript function to make a request with XMLHttpRequest, just code",
|
"javascript function to make a request with XMLHttpRequest, just code",
|
||||||
|
|
|
@ -113,30 +113,21 @@ class GoogleSearchTest : LocalProperties() {
|
||||||
@Test
|
@Test
|
||||||
fun `API key should not be empty`() {
|
fun `API key should not be empty`() {
|
||||||
assertFailure { sanitizedSearch("test", "", "apiKey") }
|
assertFailure { sanitizedSearch("test", "", "apiKey") }
|
||||||
.isInstanceOf(ModuleException::class.java)
|
.isInstanceOf(ModuleException::class.java).hasNoCause()
|
||||||
.hasMessage("${GoogleSearch.SERVICE_NAME} is disabled. The API keys are missing.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `CSE key should not be empty`() {
|
fun `CSE key should not empty`() {
|
||||||
assertFailure { sanitizedSearch("test", "apiKey", "") }
|
assertFailure { sanitizedSearch("test", "apiKey", "") }
|
||||||
.isInstanceOf(ModuleException::class.java)
|
.isInstanceOf(ModuleException::class.java).hasNoCause()
|
||||||
.hasMessage("${GoogleSearch.SERVICE_NAME} is disabled. The API keys are missing.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Invalid API key should throw exception`() {
|
fun `Invalid API key should throw exception`() {
|
||||||
assertFailure { sanitizedSearch("test", "apiKey", "cseKey") }
|
assertFailure { sanitizedSearch("test", "apiKey", "cssKey") }
|
||||||
.isInstanceOf(ModuleException::class.java)
|
.isInstanceOf(ModuleException::class.java)
|
||||||
.hasMessage("API key not valid. Please pass a valid API key.")
|
.hasMessage("API key not valid. Please pass a valid API key.")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `Invalid CSE key should throw exception`() {
|
|
||||||
assertFailure { sanitizedSearch("test", apiKey, "cseKey") }
|
|
||||||
.isInstanceOf(ModuleException::class.java)
|
|
||||||
.hasMessage("Request contains an invalid argument.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue