Example #1
0
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
Example #2
0
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')
Example #3
0
 def setUp(self):
     self.manager = WorkspaceManager(workspaces_dir=WORKSPACES_DIR)
     self.manager.delete_all_workspaces()
Example #4
0
 def setUp(self):
     self.service = WebSocketService(WorkspaceManager())
     self.clean_up_test_workspaces()
Example #5
0
 def setUp(self):
     self.manager = WorkspaceManager(workspaces_dir=WORKSPACES_DIR)