def create_application(): application = Application([ (url_pattern('/'), WebAPIVersionHandler), (url_pattern('/exit'), WebAPIExitHandler), (url_pattern('/app'), JsonRcpWebSocketHandler, dict(service_factory=service_factory, report_defer_period=WEBAPI_PROGRESS_DEFER_PERIOD)), ]) application.workspace_manager = WorkspaceManager() return application
class WorkspaceTestBase: def setUp(self): self.manager = WorkspaceManager(workspaces_dir=WORKSPACES_DIR) self.manager.delete_all_workspaces() def tearDown(self): self.manager.delete_all_workspaces() def assertIsWorkspaceDir(self, *path, expected=True): self.assertEqual(os.path.isdir(os.path.join(WORKSPACES_DIR, *path)), expected) def assertIsWorkspaceFile(self, *path, expected=True): self.assertEqual(os.path.isfile(os.path.join(WORKSPACES_DIR, *path)), expected) def assertWorkspaceFileExists(self, *path, expected=True): self.assertEqual(os.path.exists(os.path.join(WORKSPACES_DIR, *path)), expected) def assertRaisedException(self, expected_exception, expected_message, func, *args): try: func(*args) except expected_exception as e: self.assertEqual(e.message, expected_message) return self.fail("Exception expected but none thrown.") @staticmethod def createWorkspaceSubDir(*path): os.mkdir(os.path.join(WORKSPACES_DIR, *path)) @staticmethod def createWorkspaceFile(*path): open(os.path.join(WORKSPACES_DIR, *path), 'a')
def setUp(self): self.manager = WorkspaceManager(workspaces_dir=WORKSPACES_DIR) self.manager.delete_all_workspaces()
def setUp(self): self.service = WebSocketService(WorkspaceManager()) self.clean_up_test_workspaces()
def setUp(self): self.manager = WorkspaceManager(workspaces_dir=WORKSPACES_DIR)