Closed singhaidotnish closed 10 years ago
errbot.backends.test
is a test-backend for use with unit tests. You don't need these to write plugins, they're just a method to write tests to ensure your code is working correctly.
If you just want to send a specific user a specific message, all you need is to write a plugin that uses self.send()
to send the message when something specific happens. I've already made reference to that in #264.
Thank you for your reply. Sure i'll use self.send() to send message to user. How do i interpret this
"user@host.tld/resource" for me user - username host - where openfire service is running tld - ? resource - ?
Sorry although these are petty questions, since I have absolutely no clue i need your help. Thank you in advance.
user@host.tld/resource
means a Jabber ID (JID) as defined in RFC 6122. In short, it is composed of:
user
, which is the localpart
of a JID. The local user, in other wordshost.tld
, which is the domainpart
. Generally this is the domainname of your service.resource
, which is the resourcepart
. XMPP allows people to be connected multiple times, where each session is identified by a resource and a priority.For example, given I am nick on host groenen.me and I have configured my client to use the resource foobar, my full JID would be nick@groenen.me/foobar
.
When sending a message to nick@groenen.me/foobar
, it would arrive specifically on that client. The resource part may be omitted, however, so if I am connected with multiple clients, and you send only to nick@groenen.me
, the message will be routed to the resource with the highest priority.
Multi user chat (MUC) rooms are addressed the same way.
Thank you for your reply. I tried a simple plugin that will only use self.send(...). Find attached image. (errbot_send.png)
For test purpose, using this link (https://github.com/gbin/err/wiki/plugin-dev#testing), I realised that plugin_dir needs to be set. So,
class MyPluginTests(FullStackTest): def setUp(self): me = os.path.dirname(os.path.realpath(os.path.abspath(file)))
# FullStackTest does on extra_test_file.
plugin_dir = os.path.join(me, 'la', 'bla')
super(MyPluginTests, self).setUp(extra_test_file=plugin_dir)
self.send("sayeed@server","bot test", message_type="chat")
a = MyPluginTests() a.setUp()
tried running this , I get following ( errbot_runtest.png ) error.
Kindly suggest. Thank you in advance.
Would i need to login :) ?
(sorry for this long mail. There was no way to attach text file here.)
What I have done so far:
run c:\Python27\Lib\site-packages\errbot>err.by (This is ok) (see link )
and
from a python console, following works
from errbot.backends.test import FullStackTest, pushMessage, popMessage
from errbot import plugin_manager
What i have tried so far:
test_myplugin.py which gives following error.
Point is, will 1. work even if 3. is not working. ( If it's needed for test_myplugin to work ) Then how do I rectify the errors. (sorry could not attach text file, so have to put it here...)
What will it take to successfully run point no 1 successfully.
http://tny.cz/b9272ae7 ( complete listing of error )