예제 #1
0
    def test_save_command_in_couch(self):
        """ Tests if command is saved in couch """
        cm = CommandManager()

        exec_command = CommandRunInformation(**self.getDefaultCommandInfo())

        wm = WorkspaceManager(mock(ModelController), mock(PluginController))
        workspace = wm.createWorkspace(exec_command.workspace, workspaceClass=WorkspaceOnCouch)

        res = cm.saveCommand(exec_command, workspace)

        self._manager = PersistenceManagerFactory.getInstance()
        saved_doc = self._manager.getDocument(exec_command.workspace, res['id'] )

        self.assertEquals(exec_command.command, saved_doc['command'], 'Saved command diffier')
        self.assertEquals(exec_command.parameters, saved_doc['parameters'], 'Saved command diffier')
        self.assertEquals(exec_command.itime, saved_doc['itime'], 'Saved command diffier')
        self.assertEquals(exec_command.duration, saved_doc['duration'], 'Saved command diffier')
예제 #2
0
    def test_save_command_in_fs(self):
        """ Tests if command is saved in couch """
        wm = WorkspaceManager(mock(ModelController), mock(PluginController))

        command_info = self.getDefaultCommandInfo()
        command_info['workspace'] = 'new_workspace'
        exec_command = CommandRunInformation(**command_info)

        workspace = wm.createWorkspace(exec_command.workspace, workspaceClass=WorkspaceOnFS)
        wm.setActiveWorkspace(workspace)

        cm = CommandManager()

        res = cm.saveCommand(exec_command, workspace)

        self._manager = PersistenceManagerFactory.getInstance()
        # saved_doc = self._manager.getDocument(exec_command.workspace, res['id'])

        # After all
        wm.removeWorkspace(command_info['workspace'])
예제 #3
0
    def test_save_command_in_fs(self):
        """ Tests if command is saved in couch """
        wm = WorkspaceManager(mock(ModelController), mock(PluginController))

        command_info = self.getDefaultCommandInfo()
        command_info['workspace'] = 'new_workspace'
        exec_command = CommandRunInformation(**command_info)

        workspace = wm.createWorkspace(exec_command.workspace,
                                       workspaceClass=WorkspaceOnFS)
        wm.setActiveWorkspace(workspace)

        cm = CommandManager()

        res = cm.saveCommand(exec_command, workspace)

        self._manager = PersistenceManagerFactory.getInstance()
        # saved_doc = self._manager.getDocument(exec_command.workspace, res['id'])

        # After all
        wm.removeWorkspace(command_info['workspace'])
예제 #4
0
    def test_save_command_in_couch(self):
        """ Tests if command is saved in couch """
        cm = CommandManager()

        exec_command = CommandRunInformation(**self.getDefaultCommandInfo())

        wm = WorkspaceManager(mock(ModelController), mock(PluginController))
        workspace = wm.createWorkspace(exec_command.workspace,
                                       workspaceClass=WorkspaceOnCouch)

        res = cm.saveCommand(exec_command, workspace)

        self._manager = PersistenceManagerFactory.getInstance()
        saved_doc = self._manager.getDocument(exec_command.workspace,
                                              res['id'])

        self.assertEquals(exec_command.command, saved_doc['command'],
                          'Saved command diffier')
        self.assertEquals(exec_command.parameters, saved_doc['parameters'],
                          'Saved command diffier')
        self.assertEquals(exec_command.itime, saved_doc['itime'],
                          'Saved command diffier')
        self.assertEquals(exec_command.duration, saved_doc['duration'],
                          'Saved command diffier')