Skip to content

Commit

Permalink
Outline tests for added methods
Browse files Browse the repository at this point in the history
Continue local test CLI
  • Loading branch information
NeonDaniel committed Dec 8, 2023
1 parent eae8781 commit 9b1ced6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
15 changes: 11 additions & 4 deletions chatbot_core/utils/bot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ def run_local_discussion(prompter_bot: str):
discussion.
@param prompter_bot: name/entrypoint of bot to be used as a proctor
"""
import click

# Start local server
from klat_connector.mach_server import MachKlatServer
server = MachKlatServer()
Expand All @@ -693,12 +695,17 @@ def run_local_discussion(prompter_bot: str):
is_prompter=True, username="Prompter",
password=prompter_bot)
chatbots.append(prompter)

LOG.info("Local Conversation started")
# Make conversation output readable
LOG.level = "ERROR"
# TODO: Add some listener to handle incoming shouts and log them
# TODO: prevent log output going to terminal

def handle_shout(user, shout, cid, dom, timestamp):
click.echo(f"{user}: {shout}")

observer = ChatBotV1(socket=start_socket("0.0.0.0"), domain="local")
observer.handle_shout = handle_shout

prompter.send_shout("@proctor hello")
# TODO: Format conversation and remove logging to stdout
from ovos_utils import wait_for_exit_signal
wait_for_exit_signal()
for bot in chatbots:
Expand Down
2 changes: 1 addition & 1 deletion chatbot_core/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def handle_shout(self, user: str, shout: str, cid: str, dom: str, timestamp: str
:param timestamp: formatted timestamp of shout
"""
if not shout:
self.log.error(f"No shout (user={user}")
self.log.error(f"No shout (user={user})")
return
if not self.nick:
self.log.error(f"No nick! user is {self.username}")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/v2/mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional

import pika
from neon_utils import LOG
from ovos_utils.log import LOG
from neon_mq_connector import MQConnector
from neon_utils.socket_utils import b64_to_dict

Expand Down
12 changes: 12 additions & 0 deletions tests/units/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ def test_run_mq_bot(self):
from chatbot_core.utils.bot_utils import run_mq_bot
# TODO

def test_run_sio_bot(self):
from chatbot_core.utils.bot_utils import run_sio_bot
# TODO

def test_run_all_bots(self):
from chatbot_core.utils.bot_utils import run_all_bots
# TODO

def test_run_local_discussion(self):
from chatbot_core.utils.bot_utils import run_local_discussion
# TODO


class CacheTests(unittest.TestCase):
from chatbot_core.utils.cache import FIFOCache
Expand Down

0 comments on commit 9b1ced6

Please sign in to comment.