File size: 1,098 Bytes
87337b1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#
# Copyright © 2024 Agora
# This file is part of TEN Framework, an open source project.
# Licensed under the Apache License, Version 2.0, with certain conditions.
# Refer to the "LICENSE" file in the root directory for more information.
#
from pathlib import Path
from ten import ExtensionTester, TenEnvTester, Cmd, CmdResult, StatusCode
class ExtensionTesterBasic(ExtensionTester):
def check_hello(self, ten_env: TenEnvTester, result: CmdResult):
statusCode = result.get_status_code()
print("receive hello_world, status:" + str(statusCode))
if statusCode == StatusCode.OK:
ten_env.stop_test()
def on_start(self, ten_env: TenEnvTester) -> None:
new_cmd = Cmd.create("hello_world")
print("send hello_world")
ten_env.send_cmd(
new_cmd,
lambda ten_env, result, _: self.check_hello(ten_env, result),
)
print("tester on_start_done")
ten_env.on_start_done()
def test_basic():
tester = ExtensionTesterBasic()
tester.set_test_mode_single("neuphonic_tts")
tester.run()
|