Files
letta-server/tests/test_cli.py
Sarah Wooders 9601b53010 refactor: move API to standardized pydantic schemas across CLI, Python client, REST server (cleaned up git history) (#1659)
Co-authored-by: cpacker <packercharles@gmail.com>
Co-authored-by: matthew zhou <matthewzhou@matthews-MacBook-Pro.local>
Co-authored-by: Zack Field <field.zackery@gmail.com>
Co-authored-by: robingotz <tug29225@temple.edu>
Co-authored-by: Vandracon <vandracon@yahoo.com>
Co-authored-by: Maximilian-Winter <maximilian.winter.91@gmail.com>
Co-authored-by: Scott <scott@vysona.com>
Co-authored-by: Jonathan Ward <jonathan.ward7892@gmail.com>
Co-authored-by: madgrizzle <john@thehogans.name>
Co-authored-by: Carlo <284474102@qq.com>
Co-authored-by: Shubham Naik <shubham.naik10@gmail.com>
Co-authored-by: Robin Goetz <35136007+goetzrobin@users.noreply.github.com>
2024-08-16 19:33:47 -07:00

45 lines
1.4 KiB
Python

import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "pexpect"])
from prettytable.colortable import ColorTable
from memgpt.cli.cli_config import ListChoice, add, delete
from memgpt.cli.cli_config import list as list_command
# def test_configure_memgpt():
# configure_memgpt()
options = [ListChoice.agents, ListChoice.sources, ListChoice.humans, ListChoice.personas]
def test_cli_list():
for option in options:
output = list_command(arg=option)
# check if is a list
assert isinstance(output, ColorTable)
def test_cli_config():
# test add
for option in ["human", "persona"]:
# create initial
add(option=option, name="test", text="test data")
## update
# filename = "test.txt"
# open(filename, "w").write("test data new")
# child = pexpect.spawn(f"poetry run memgpt add --{str(option)} {filename} --name test --strip-ui")
# child.expect("Human test already exists. Overwrite?", timeout=TIMEOUT)
# child.sendline()
# child.expect(pexpect.EOF, timeout=TIMEOUT) # Wait for child to exit
# child.close()
for row in list_command(arg=ListChoice.humans if option == "human" else ListChoice.personas):
if row[0] == "test":
assert "test data" in row
# delete
delete(option=option, name="test")