-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add AI studio tests (box/box-codegen#626)
- Loading branch information
1 parent
0da38a1
commit 69eba35
Showing
3 changed files
with
82 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "engineHash": "c1e6fc8", "specHash": "f20ba3f", "version": "0.5.0" } | ||
{ "engineHash": "8a9cc1d", "specHash": "f20ba3f", "version": "0.5.0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/test/java/com/box/sdkgen/test/aistudio/AiStudioITest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.box.sdkgen.test.aistudio; | ||
|
||
import static com.box.sdkgen.internal.utils.UtilsManager.convertToString; | ||
import static com.box.sdkgen.internal.utils.UtilsManager.getUuid; | ||
import static com.box.sdkgen.test.commons.CommonsManager.getDefaultClient; | ||
|
||
import com.box.sdkgen.client.BoxClient; | ||
import com.box.sdkgen.managers.aistudio.GetAiAgentByIdQueryParams; | ||
import com.box.sdkgen.schemas.aimultipleagentresponse.AiMultipleAgentResponse; | ||
import com.box.sdkgen.schemas.aisingleagentresponsefull.AiSingleAgentResponseFull; | ||
import com.box.sdkgen.schemas.aistudioagentask.AiStudioAgentAsk; | ||
import com.box.sdkgen.schemas.createaiagent.CreateAiAgent; | ||
import java.util.Arrays; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class AiStudioITest { | ||
|
||
private static final BoxClient client = getDefaultClient(); | ||
|
||
@Test | ||
public void testAiStudioCrud() { | ||
String agentName = getUuid(); | ||
AiSingleAgentResponseFull createdAgent = | ||
client | ||
.getAiStudio() | ||
.createAiAgent( | ||
new CreateAiAgent.CreateAiAgentBuilder(agentName, "enabled") | ||
.ask(new AiStudioAgentAsk("enabled", "desc1")) | ||
.build()); | ||
assert createdAgent.getName().equals(agentName); | ||
AiMultipleAgentResponse agents = client.getAiStudio().getAiAgents(); | ||
int numAgents = agents.getEntries().size(); | ||
assert convertToString(agents.getEntries().get(0).getType()).equals("ai_agent"); | ||
AiSingleAgentResponseFull retrievedAgent = | ||
client | ||
.getAiStudio() | ||
.getAiAgentById( | ||
createdAgent.getId(), | ||
new GetAiAgentByIdQueryParams.GetAiAgentByIdQueryParamsBuilder() | ||
.fields(Arrays.asList("ask")) | ||
.build()); | ||
assert retrievedAgent.getName().equals(agentName); | ||
assert convertToString(retrievedAgent.getAccessState()).equals("enabled"); | ||
assert convertToString(retrievedAgent.getAsk().getAccessState()).equals("enabled"); | ||
assert retrievedAgent.getAsk().getDescription().equals("desc1"); | ||
AiSingleAgentResponseFull updatedAgent = | ||
client | ||
.getAiStudio() | ||
.updateAiAgentById( | ||
createdAgent.getId(), | ||
new CreateAiAgent.CreateAiAgentBuilder(agentName, "enabled") | ||
.ask(new AiStudioAgentAsk("disabled", "desc2")) | ||
.build()); | ||
assert convertToString(updatedAgent.getAccessState()).equals("enabled"); | ||
assert convertToString(updatedAgent.getAsk().getAccessState()).equals("disabled"); | ||
assert updatedAgent.getAsk().getDescription().equals("desc2"); | ||
client.getAiStudio().deleteAiAgentById(createdAgent.getId()); | ||
AiMultipleAgentResponse agentsAfterDelete = client.getAiStudio().getAiAgents(); | ||
assert agentsAfterDelete.getEntries().size() == numAgents - 1; | ||
} | ||
} |