def test_empty_array(self): changes = [] self.assertTrue(IDEController.is_valid_changes(changes))
def test_bad_type(self): path = 0 self.assertFalse(IDEController.is_valid_path(path))
def test_parent_with_root(self): path = "/.." self.assertFalse(IDEController.is_valid_path(path))
def test_with_root_dir_current(self): path = "/node/." # meaning /node/ self.assertFalse(IDEController.is_valid_path(path))
def test_no_root_ending_slash(self): path = "node/" self.assertFalse(IDEController.is_valid_path(path))
def test_no_root_dir_current_file(self): path = "node/./node2" # meaning / self.assertFalse(IDEController.is_valid_path(path))
def test_bad_count_value(self): changes = [dict(count=-1, pos=0, type=-1)] self.assertFalse(IDEController.is_valid_changes(changes))
def test_root(self): path = "/" self.assertFalse(IDEController.is_valid_path(path))
def test_both_content_count_keys_2(self): changes = [dict(content='abc', count=1, pos=0, type=-1)] self.assertFalse(IDEController.is_valid_changes(changes))
def test_bad_content_type(self): changes = [dict(content=0, pos=0, type=1)] self.assertFalse(IDEController.is_valid_changes(changes))
def test_missing_content_count_keys(self): changes = [dict(pos=0, type=str(10))] self.assertFalse(IDEController.is_valid_changes(changes))
def test_bad_element_type(self): changes = [['abc', 1, 0]] self.assertFalse(IDEController.is_valid_changes(changes))
def test_bad_type(self): changes = 0 self.assertFalse(IDEController.is_valid_changes(changes))
def test_empty_string(self): path = "" self.assertFalse(IDEController.is_valid_path(path))
def test_bad_type_type(self): changes = [dict(content='abc', pos=0, type=str(10))] self.assertFalse(IDEController.is_valid_changes(changes))
def test_current_no_root(self): path = "." self.assertFalse(IDEController.is_valid_path(path))
def test_missing_pos_key(self): changes = [dict(content='abc', type=1)] self.assertFalse(IDEController.is_valid_changes(changes))
def test_file_with_dot_no_root(self): path = "node.py" self.assertFalse(IDEController.is_valid_path(path))
def test_bad_pos_value(self): changes = [dict(content='abc', pos=-13, type=1)] self.assertFalse(IDEController.is_valid_changes(changes))
def test_no_root_dir_parent(self): path = "node/.." # meaning / self.assertFalse(IDEController.is_valid_path(path))
def test_valid_add_unicode(self): changes = [dict(content=u'abc', pos=0, type=1)] self.assertTrue(IDEController.is_valid_changes(changes))
def test_dir_multiple_parent_no_root(self): path = "../../.." self.assertFalse(IDEController.is_valid_path(path))
def test_valid_remove(self): changes = [dict(count=10, pos=0, type=-1)] self.assertTrue(IDEController.is_valid_changes(changes))
def test_with_root_ending_slash_with_spaces(self): path = "/node/ " self.assertFalse(IDEController.is_valid_path(path))
def test_file_with_dot_with_root_unicode(self): path = u"/node.py" self.assertTrue(IDEController.is_valid_path(path))
cherrypy.config.update(server_conf_file) # Loading and setting Websocket plugin WebSocketPlugin(cherrypy.engine).subscribe() cherrypy.tools.websocket = WebSocketTool() # Instanciate App chatApp = Chat(logger) coreApp = Core(project_conf, core_conf, logger) # Bind for server event (start/stop) cherrypy.engine.subscribe('start', coreApp.start) cherrypy.engine.subscribe('stop', coreApp.stop) # Load Identification/Auth handler cherrypy.tools.auth = cherrypy.Tool('before_handler', check_identify) # Map URI path to controllers cherrypy.tree.mount(WelcomeController(logger), "/", welcomeController_conf_file) cherrypy.tree.mount(IDEController(coreApp, templates_dir, logger), "/ide", ideController_conf_file) cherrypy.tree.mount(ChatController(chatApp, logger), "/chat", chatController_conf_file) cherrypy.tree.mount(IdentifyController(templates_dir, logger), "/identify", identifyController_conf_file) # Start server cherrypy.engine.start() cherrypy.engine.block()
def test_file_with_root(self): path = "/node" self.assertTrue(IDEController.is_valid_path(path))