Exemplo n.º 1
0
    def testStrategy(self):
        # Let's prepare a configuration
        newConfig = Configuration()
        newConfig.retainStrategies.append(RetainStrategy('myStrategy'))

        newTask = Task('myName', [], 'myStrategy')
        newConfig.tasks.append(newTask)
        newTask.configuration = newConfig

        strat = newTask.strategy()
        self.assert_(strat <> None, 'No Strategy returned')
        self.assert_(strat.name == 'myStrategy', 'Wrong Strategy returned')
Exemplo n.º 2
0
    def testDefinitions(self):
        # Let's prepare a configuration
        newConfig = Configuration()
        newConfig.definitions.append(
            Definition('name1', 'dir', 'C:/temp1', './C/temp1'))
        newConfig.definitions.append(
            Definition('name2', 'dir', 'C:/temp2', './C/temp2'))
        newConfig.definitions.append(
            Definition('name3', 'dir', 'C:/temp3', './C/temp3'))

        # And now the task
        newTask = Task('myName', ['name1', 'name3', 'badConf'])
        newConfig.tasks.append(newTask)
        newTask.configuration = newConfig

        # Now the actual test
        defs = newTask.defintions()
        self.assert_(defs <> None, 'No defs returned')
        self.assert_(len(defs) == 2, 'Nb of found defs not OK')
        self.assert_(defs[0].name == 'name1', 'Name of first def not OK')
        self.assert_(defs[1].name == 'name3', 'Name of second def not OK')