def test_prologue(self): from chatbot.client import Client cli = Client() cli.do_conn("localhost:" + PORT) while not cli.ping(): time.sleep(1) cli.do_select("sophia") ret, response = cli.ask("what is your name") ans = response.get("text") names = ["Soepheeyeh", "Sophia"] self.assertTrue(any([name in ans for name in names]))
def test_two_clients(self): cli = Client('AAAAB3NzaC', botname='generic', port=PORT, test=True) cli2 = Client('AAAAB3NzaC', botname='sophia', port=PORT, test=True) while not cli.ping(): time.sleep(1) cli.do_conn('localhost:' + PORT) cli2.do_conn('localhost:' + PORT) response = cli.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from generic') response = cli2.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from sophia')
def test_prologue(self): cli = Client('AAAAB3NzaC', username='******', port=PORT, test=True) while not cli.ping(): time.sleep(1) cli.do_conn('localhost:' + PORT) cli.do_select('generic') response = cli.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from generic') cli.do_select('sophia') response = cli.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from sophia')
def test_two_clients(self): cli = Client('AAAAB3NzaC', botname='generic', port=self.port, test=True) cli2 = Client('AAAAB3NzaC', botname='sophia', port=self.port, test=True) while not cli.ping(): time.sleep(1) cli.do_conn('localhost:' + self.port) cli2.do_conn('localhost:' + self.port) response = cli.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from generic') response = cli2.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from sophia')
def test_prologue(self): cli = Client('AAAAB3NzaC', username='******', port=self.port, test=True) while not cli.ping(): time.sleep(1) cli.do_conn('localhost:' + self.port) cli.do_select('generic') response = cli.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from generic') cli.do_select('sophia') response = cli.ask('hello sophia') self.assertTrue(response.get('text') == 'Hi there from sophia')
def test_prologue(self): from chatbot.client import Client cli = Client('test_client', 'AAAAB3NzaC', test=True) cli.do_port(PORT) while not cli.ping(): time.sleep(1) cli.do_conn('localhost:' + PORT) cli.do_select('generic') ret, response = cli.ask('hello sophia') self.assertTrue(ret == 0) self.assertTrue(response.get('text') == 'Hi there from generic') cli.do_select('sophia') ret, response = cli.ask('hello sophia') self.assertTrue(ret == 0) self.assertTrue(response.get('text') == 'Hi there from sophia')