'Test to add an callback.'

def test_add(self):

    self.call(CmdCallback(), '/add    out    =    traverse')
    editor = self.char1.ndb._eveditor
    self.assertIsNotNone(editor)
    editor.update_buffer(dedent('\n                                                if    character.key    ==    "one":\n                                                                character.msg("You    can    pass.")\n                                                else:\n                                                                character.msg("You    can\'t    pass.")\n                                                                deny()\n                                '.strip('\n')))
    editor.save_buffer()
    editor.quit()
    callback = self.exit.callbacks.get('traverse')[0]
    self.assertEqual(callback.author, self.char1)
    self.assertEqual(callback.valid, True)
    self.assertTrue((len(callback.code) > 0))
    self.call(CmdCallback(), '/add    out    =    traverse', caller=self.char2)
    editor = self.char2.ndb._eveditor
    self.assertIsNotNone(editor)
    editor.update_buffer(dedent('\n                                                character.msg("No    way.")\n                                '.strip('\n')))
    editor.save_buffer()
    editor.quit()
    callback = self.exit.callbacks.get('traverse')[1]
    self.assertEqual(callback.author, self.char2)
    self.assertEqual(callback.valid, False)
    self.assertTrue((len(callback.code) > 0))
