TestBase   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 39
rs 10
wmc 14

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testLoad() 0 6 2
A testBotSocket() 0 6 2
B testEventMatches() 0 8 5
A testConfman() 0 3 1
A testBase() 0 4 2
A testConfExistence() 0 3 2
1
class TestBase():
2
  conf = 'tests/test_pybotrc'
3
  def testConfExistence(self):
4
    f = open (TestBase.conf)
5
    assert f is not None
6
7
  def testConfman(self):
8
    import confman
9
    cm = confman.ConfManager(TestBase.conf)
10
11
  def testBase(self):
12
    import bot
13
    import confman
14
    assert bot.Bot(confman.ConfManager(TestBase.conf), "zero9f9.com") is not None, "bot is None!"
15
16
  # this one you might want to remove, since it connects to a hardcoded ircd
17
  def testBotSocket(self):
18
    import bot
19
    import confman
20
    b = bot.Bot(confman.ConfManager(TestBase.conf), "zero9f9.com", True)
21
    b.worker(mock=True)
22
    assert b.s is not None
23
24
  # if this fails someone screwed something up
25
  def testEventMatches(self):
26
    import event
27
    e = event.Event('__.test__')
28
    assert e is not None
29
    assert e._type is not None and e._type == "__.test__"
30
    e.define(msg_definition="^test")
31
    assert e.msg_definition == "^test"
32
    assert e.matches(":[email protected] PRIVMSG #bots :test") == True
33
34
  def testLoad(self):
35
    import bot
36
    import confman
37
    b = bot.Bot(confman.ConfManager(TestBase.conf), "zero9f9.com", True)
38
    b.load_modules()
39
    assert len(b.loaded_modules) > 0
40