testBase.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. class TestBase():
  2. conf = 'tests/test_pybotrc'
  3. def testConfExistence(self):
  4. f = open (TestBase.conf)
  5. assert f is not None
  6. def testConfman(self):
  7. import confman
  8. cm = confman.ConfManager(TestBase.conf)
  9. def testBase(self):
  10. import bot
  11. import confman
  12. assert bot.Bot(confman.ConfManager(TestBase.conf), "zero9f9.com") is not None, "bot is None!"
  13. # this one you might want to remove, since it connects to a hardcoded ircd
  14. def testBotSocket(self):
  15. import bot
  16. import confman
  17. b = bot.Bot(confman.ConfManager(TestBase.conf), "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
  29. def testLoad(self):
  30. import bot
  31. import confman
  32. b = bot.Bot(confman.ConfManager(TestBase.conf), "zero9f9.com", True)
  33. b.load_modules()
  34. assert len(b.loaded_modules) > 0