Beispiel #1
0
	def bot_reply(self):
		if self.comment_type == 'Bot' and self.communication_type == 'Chat':
			reply = BotReply().get_reply(self.content)
			if reply:
				frappe.get_doc({
					"doctype": "Communication",
					"comment_type": "Bot",
					"communication_type": "Bot",
					"content": cstr(reply),
					"reference_doctype": self.reference_doctype,
					"reference_name": self.reference_name
				}).insert()
				frappe.local.flags.commit = True
Beispiel #2
0
	def test_list(self):
		reply = BotReply().get_reply('list users')
		self.assertTrue('(#Form/User/[email protected])' in reply)
Beispiel #3
0
	def test_how_many(self):
		reply = BotReply().get_reply('how many users')
		self.assertTrue(int(reply) > 1)
Beispiel #4
0
	def test_not_found(self):
		reply = BotReply().get_reply('find yoyo in doctypes')
		self.assertTrue('Could not find' in reply)
Beispiel #5
0
	def test_find(self):
		reply = BotReply().get_reply('find user in doctypes')
		self.assertTrue('[User](#Form/DocType/User)' in reply)
Beispiel #6
0
	def test_open_notifications(self):
		reply = BotReply().get_reply('whatsup')
		self.assertTrue('your attention' in reply)
Beispiel #7
0
	def test_hello(self):
		reply = BotReply().get_reply('hello')
		self.assertEqual(reply, 'Hello Administrator')
 def test_list(self):
     reply = BotReply().get_reply('list users')
     self.assertTrue('[[email protected]]' in reply)