コード例 #1
0
def test_handle_command_lyrics():
    app.test_mode()
    # msg = {}
    # msg['text'] = '/lyrics the art of dying by gojira'
    # msg['from'] = {}
    # msg['message_id'] = 0
    # msg['chat'] = {'id' : 0}
    app.handle('/lyrics the art of dying by gojira', 0, 0)
コード例 #2
0
def test_handle_translate2():
    app.test_mode()
    # msg = {}
    # msg['text'] = '没有人 overnight 的'
    # msg['from'] = {}
    # msg['message_id'] = 0
    # msg['chat'] = {'id' : 0}
    app.handle('没有人 overnight 的', 0, 0)
コード例 #3
0
def test_handle_translate1():
    app.test_mode()
    # msg = {}
    # msg['text'] = 'dui you ne?'
    # msg['from'] = {}
    # msg['message_id'] = 0
    # msg['chat'] = {'id' : 0}
    app.handle('dui you ne?', 0, 0)
コード例 #4
0
ファイル: test_app.py プロジェクト: kianhean/ShiokBot2
    def test_start(self):
        """ Mock Using Local Json """

        with open("fixtures/start.json") as json_data:
            data = json.load(json_data)

        output = app.handle(data)
        self.assertEqual(output['response'], "/start")
コード例 #5
0
ファイル: test_app.py プロジェクト: kianhean/ShiokBot2
    def test_parse_jason_response(self):
        """ Mock Using Local Json """

        with open("fixtures/basic.json") as json_data:
            data = json.load(json_data)

        output = app.handle(data)
        self.assertEqual(output['content_type'], 'text')
        self.assertEqual(output['chat_id'], 22959774)
        self.assertEqual(output['response'], "_NOACTION_")
コード例 #6
0
def receive(body):
    """ Simple Hug Server """
    output = handle(body)
    return output
コード例 #7
0
def test_handle_back():
    # msg = {'date' : 0}
    app.handle('', 0, 0, datetime.utcfromtimestamp(0))
コード例 #8
0
def test_handle():
    # msg = {}
    # msg['text'] = 'Fake message'
    # msg['from'] = {}
    # msg['chat'] = {'id' : 0}
    app.handle('Fake message', 0, 0)
コード例 #9
0
	# Read lines printed by Arduino
	line = ser.readline()
	print line

	# Ignore account balance messages
	#if line[:16] == '+CMT: "78108858"':
	#	ser.readline()
		
	if line[:4] == '+CMT':
		#print line
		ph_num = line[8:19]
		print ph_num
		text = ser.readline()
		print text
		out_msg = handle(text)
		print out_msg
		ser.write('o')
		ser.write(str(ph_num))
		ser.write(str(out_msg))


# Request new data incoming from Arduino,
# where "i" is a case initializer in the Arduino code.
# ser.write("i")


# Pass commands and data to the Arduino
#ser.write("o"+str(ph_num)+"\r"+str(outgoingMessage))