def test_not_command(self): response = functions.get_chatbot_response("!! add 4 6") #print(response) self.assertEquals(response, 10) #self.assertEquals(response, 9) response2 = functions.get_chatbot_response("!! divide 10 5") #print(response) self.assertEquals(response2, 2)
def test_not_command(self): # response = functions.get_chatbot_response("Purple") response = functions.get_chatbot_response("!! add 5 3") print(response) self.assertEquals(response, 8) response = functions.get_chatbot_response("!! divide 5 3") print(response) self.assertEquals(response, 1)
def test_Cross(self): response = functions.get_chatbot_response('!! cross') if (response == cross1): self.assertEquals(response, cross1) elif (response == cross2): self.assertEquals(response, cross2) else: self.assertEquals(response, "")
def test_divide_command(self): response = functions.get_chatbot_response('!! divide 6 2') self.assertEquals(response, 3)
def test_add_command(self): response = functions.get_chatbot_response('!! add 2 3') self.assertEquals(response, 5)
def on_new_number(data): response = requests.get( 'https://graph.facebook.com/v2.8/me?fields=id%2Cname%2Cpicture&access_token=' + data['facebook_user_token']) json = response.json() global chickenBotVer check = True ##connected user messages-------------------------------------------------------------------------------------------------------------------------------------------- if (data['number'] == "connected"): if (data['facebook_user_token'] != ''): check = True for key in all_users: if key['name'] == json['name']: check = False socketio.emit('all users', {'users': all_users}) all_mah_numbers.append({ 'name': 'ChickenBot ' + str(chickenBotVer), 'picture': 'https://cdn4.iconfinder.com/data/icons/social-productivity-line-art-5/128/chatbot-128.png', 'number': json['name'] + " " + data['number'] }) socketio.emit('all numbers', {'numbers': all_mah_numbers}) if check == True: all_users.append({ 'name': json['name'], 'picture': json['picture']['data']['url'], }) socketio.emit('all users', {'users': all_users}) elif (data['facebook_user_token'] == ''): response2 = requests.get( 'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=' + data['google_user_token']) json2 = response2.json() check = True for key in all_users: if key['name'] == json['name']: print "name" + key check = False socketio.emit('all users', {'users': all_users}) all_mah_numbers.append({ 'name': 'ChickenBot ' + str(chickenBotVer), 'picture': 'https://cdn4.iconfinder.com/data/icons/social-productivity-line-art-5/128/chatbot-128.png', 'number': json2['name'] + " " + data['number'] }) socketio.emit('all numbers', {'numbers': all_mah_numbers}) if check == True: all_users.append({ 'name': json2['name'], 'picture': json2['picture'] }) ##--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ## APPEND Facebook user message to list--------------------------------------------------------------------------------------------------------------------------------------------- elif (data['number'] != "connected"): if data['facebook_user_token'] != '': if links.checkURL(data['number']): t1 = links.isImage(data['number']) print t1 if t1 == True: all_mah_numbers.append({ 'name': json['name'], 'picture': json['picture']['data']['url'], 'number': "", 'link': "", 'picL': data['number'] }) else: all_mah_numbers.append({ 'name': json['name'], 'picture': json['picture']['data']['url'], 'number': "", 'link': data['number'], }) else: all_mah_numbers.append({ 'name': json['name'], 'picture': json['picture']['data']['url'], 'number': data['number'], 'link': "", }) elif data['facebook_user_token'] == '': t = links.checkURL(data['number']) print "**********************************" + str( links.checkURL(data['number'])) if links.checkURL(data['number']): t1 = links.isImage(data['number']) print t1 if t1 == True: response2 = requests.get( 'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=' + data['google_user_token']) json2 = response2.json() print "**********************************************************************************" + data[ 'number'] all_mah_numbers.append({ 'name': json2['name'], 'picture': json2['picture'], 'number': "", 'link': "", 'picL': data['number'] }) else: response2 = requests.get( 'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=' + data['google_user_token']) json2 = response2.json() all_mah_numbers.append({ 'name': json2['name'], 'picture': json2['picture'], 'number': "", 'link': data['number'], 'n.picL': "" }) else: response2 = requests.get( 'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=' + data['google_user_token']) json2 = response2.json() all_mah_numbers.append({ 'name': json2['name'], 'picture': json2['picture'], 'number': data['number'], 'link': "", 'n.picL': "" }) ##--------------------------------------------------------------------------------------------------------------------------------------------- socketio.emit('all numbers', {'numbers': all_mah_numbers}) socketio.emit('all users', {'users': all_users}) ###Bot functionality -------------------------------------------------------------------------------------------------------------------------- spl = str.split(str(data['number'])) if (spl[0] == "!!"): all_mah_numbers.append(functions.get_chatbot_response(data['number'])) ###------------------------------------------------------------------------------------------------------------------------------------------- socketio.emit('all numbers', {'numbers': all_mah_numbers}) socketio.emit('all users', {'users': all_users})
def test_help(self): response = functions.get_chatbot_response('!! help') self.assertEquals(response, help)
def test_not_command(self): response = functions.get_chatbot_response("!! add 2 2") print(response) self.assertEquals(response,22)
def test_about(self): response = functions.get_chatbot_response('!! about') self.assertEquals(response, about)
def test_Rank_No_region(self): response = functions.get_chatbot_response('!! rank anniebot') self.assertEquals(response['number'], "ERROR: Either no summoner name or Region given")
def test_not_command(self): response = functions.get_chatbot_response("!! Purple ") self.assertEqual(response, "Oops! I didn't recognize your command :(")
def test_regular_strings(self): response = functions.get_chatbot_response("blah blah") self.assertEqual(response,'')
def test_say_command(self): response = functions.get_chatbot_response("!! say Hello World!") self.assertEqual(response,"Hello World!")
def test_hey_command(self): response = functions.get_chatbot_response("!! Hey ") self.assertEqual(response,"What's up!")
def test_divide_command(self): response = functions.get_chatbot_response("!! divide 8 2") self.assertEqual(response,4)
def test_add_command(self): response = functions.get_chatbot_response("!! add 10 10") self.assertEquals(response, 20)
def test_say_command(self): response = functions.get_chatbot_response("!! say word") self.assertEquals(response, "word")
def test_say_command(self): response = functions.get_chatbot_response('!! say butts') self.assertEquals(response, 'butts')
def test_hello_command(self): response = functions.get_chatbot_response('!! hello there') self.assertEquals(response, 'Hey there!')
def test_add_command(self): response = functions.get_chatbot_response("!! add 8 2") self.assertEqual(response,10)
def test_Rank_region2(self): response = functions.get_chatbot_response('!! rank na doublelift') self.assertEquals(response, doublelift)
def test_joke(self): response = functions.get_chatbot_response('!! joke') for i in jokes: if str(response['number']) == str(i): k = i self.assertEqual(str(response['number']), k)
def test_say_command(self): response = functions.get_chatbot_response('!! say dang dude') self.assertEquals(response, say)
def test_first_command(self): response = functions.get_chatbot_response('hello') self.assertEquals(response, points, a)
def test_not_command(self): response = functions.get_chatbot_response('!! Potato') self.assertEquals(response, potato)
def test_not_command(self): response = functions.get_chatbot_response("Purple") self.assertEqual(response, "")
def test_say_blank(self): response = functions.get_chatbot_response('!! say') self.assertEquals(response, blank)
def test_add_command(self): response = functions.get_chatbot_response(''' put something here ''') self.assertEqual(''' put something here''')
def test_Rank_region(self): response = functions.get_chatbot_response('!! rank na anniebot') self.assertEquals(response, annie)
def test_not_command(self): response = functions.get_chatbot_response('hello') self.assertEquals(response, '')