testBase.py 993 B

123456789101112131415161718192021222324252627282930313233
  1. class TestBase():
  2. def testConfExistence(self):
  3. f = open ('pybotrc')
  4. assert f is not None
  5. def testConfman(self):
  6. import confman
  7. cm = confman.ConfManager("pybotrc")
  8. def testBase(self):
  9. import bot
  10. import confman
  11. assert bot.Bot(confman.ConfManager("pybotrc"), "zero9f9.com") is not None, "bot is None!"
  12. # this one you might want to remove, since it connects to a hardcoded ircd
  13. def testBotSocket(self):
  14. import bot
  15. import confman
  16. from subprocess import call
  17. b = bot.Bot(confman.ConfManager("pybotrc"), "zero9f9.com", True)
  18. b.worker(mock=True)
  19. assert b.s is not None
  20. # if this fails someone screwed something up
  21. def testEventMatches(self):
  22. import event
  23. e = event.Event('__.test__')
  24. assert e is not None
  25. assert e._type is not None and e._type == "__.test__"
  26. e.define(msg_definition="^test")
  27. assert e.msg_definition == "^test"
  28. assert e.matches(":hlmtre!~hlmtre@bxr.bxr.bxr PRIVMSG #bots :test") == True