示例#1
0
 def test_workspace_serialization(self):
     workspace = Workspace(name="workspace_test")
     workspace.setDescription("Some description")
     workspace.setCustomer("Infobyte")
     wserialized = self.wmapper.serialize(workspace)
     # if serialization fails, returns None
     self.assertNotEqual(
         wserialized,
         None,
         "Serialized workspace shouldn't be None")
     # we check the host attributes
     self.assertEquals(
         wserialized.get("_id"),
         workspace.getID(),
         "Serialized ID is not the same as workspace ID")
     self.assertEquals(
         wserialized.get("name"),
         workspace.getName(),
         "Serialized name is not the same as workspace name")
     self.assertEquals(
         wserialized.get("description"),
         workspace.getDescription(),
         "Serialized description is not the same as workspace description")
     self.assertEquals(
         wserialized.get("customer"),
         workspace.getCustomer(),
         "Serialized customer is not the same as workspace customer")
示例#2
0
 def openDefaultWorkspace(self):
     # This method opens the default workspace called 'untitled'
     if "untitled" not in self.getWorkspacesNames():
         workspace = Workspace("untitled", "default workspace")
         dbConnector = self.dbManager.createDb(workspace.getName(), DBTYPE.FS)
         if self.active_workspace:
             self.closeWorkspace()
         self.mappersManager.createMappers(dbConnector)
         self.mappersManager.save(workspace)
     return self.openWorkspace("untitled")
示例#3
0
    def testGetWorkspaceTypeFS(self):
        work = Workspace('testname')
        dbManager = mock()
        mappersManager = mock()
        changesController = mock()
        when(dbManager).getDbType('testname').thenReturn(DBTYPE.FS)
        workspace_manager = WorkspaceManager(dbManager, mappersManager, changesController, mock())

        wtype = workspace_manager.getWorkspaceType(work.getName())
        self.assertEquals(wtype, 'FS', 'Workspace type not returning correct value')
示例#4
0
 def openDefaultWorkspace(self):
     #This method opens the default workspace called 'untitled'
     if 'untitled' not in self.getWorkspacesNames():
         workspace = Workspace('untitled', 'default workspace')
         dbConnector = self.dbManager.createDb(workspace.getName(),
                                               DBTYPE.FS)
         if self.active_workspace:
             self.closeWorkspace()
         self.mappersManager.createMappers(dbConnector)
         self.mappersManager.save(workspace)
     return self.openWorkspace('untitled')
示例#5
0
    def testGetWorkspaceTypeFS(self):
        work = Workspace('testname')
        dbManager = mock()
        mappersManager = mock()
        changesController = mock()
        when(dbManager).getDbType('testname').thenReturn(DBTYPE.FS)
        workspace_manager = WorkspaceManager(dbManager, mappersManager,
                                             changesController, mock())

        wtype = workspace_manager.getWorkspaceType(work.getName())
        self.assertEquals(wtype, 'FS',
                          'Workspace type not returning correct value')
示例#6
0
    def testSetActiveWorkspace(self):
        work = Workspace('testname')
        dbManager = mock()
        mappersManager = mock()
        changesController = mock()
        workspace_manager = WorkspaceManager(dbManager, mappersManager, changesController, mock())

        workspace_manager.setActiveWorkspace(work)

        self.assertEquals(workspace_manager.active_workspace, work,
                'active workspace not set')
        self.assertTrue(workspace_manager.isActive(work.getName()),
                'could not retrive as active workspace')
示例#7
0
    def testSetActiveWorkspace(self):
        work = Workspace('testname')
        dbManager = mock()
        mappersManager = mock()
        changesController = mock()
        workspace_manager = WorkspaceManager(dbManager, mappersManager,
                                             changesController, mock())

        workspace_manager.setActiveWorkspace(work)

        self.assertEquals(workspace_manager.active_workspace, work,
                          'active workspace not set')
        self.assertTrue(workspace_manager.isActive(work.getName()),
                        'could not retrive as active workspace')