Esempio n. 1
0
 def test_transitionsAddedToMachines(self):
     configuration = config.Configuration(self.baseDict)
     myMachine = configuration.machines[self.machineName]
     self.assertEquals(len(myMachine.transitions), 2)
     trans1Name = self.initialStateName + '--event1'
     trans2Name = self.initialStateName + '--event2'
     self.assertEquals(myMachine.transitions[trans1Name].name, trans1Name)
     self.assertEquals(myMachine.transitions[trans2Name].name, trans2Name)
Esempio n. 2
0
 def _test(self, yamlString):
     """ just tests that it can be built """
     import StringIO, yaml
     yamlFile = StringIO.StringIO()
     yamlFile.write(yamlString)
     yamlFile.seek(0)
     configDict = yaml.load(yamlFile.read())
     configuration = config.Configuration(configDict)
     self.assertTrue(configuration)
Esempio n. 3
0
 def test_multipleMachinesParsed(self):
     otherMachineName = 'OtherMachine'
     self.baseDict[constants.STATE_MACHINES_ATTRIBUTE].append(
         {
             constants.MACHINE_NAME_ATTRIBUTE: otherMachineName,
             constants.MACHINE_STATES_ATTRIBUTE: [
                 {
                     constants.STATE_NAME_ATTRIBUTE: self.initialStateName,
                     constants.STATE_ACTION_ATTRIBUTE: 'fantasm_tests.MockAction2',
                     constants.STATE_INITIAL_ATTRIBUTE: True,
                     constants.STATE_FINAL_ATTRIBUTE: True
                 }
             ]
         }
     )
     configuration = config.Configuration(self.baseDict)
     self.assertEquals(configuration.machines[self.machineName].name, self.machineName)
     self.assertEquals(configuration.machines[otherMachineName].name, otherMachineName)
Esempio n. 4
0
 def test_builtInMachinesImported(self):
     configuration = config.Configuration(self.baseDict)
     self.assertTrue('FantasmScrubber' in configuration.machines)
     self.assertTrue('init' in configuration.machines['FantasmScrubber'].states)
Esempio n. 5
0
 def test_statesAddedToMachines(self):
     configuration = config.Configuration(self.baseDict)
     myMachine = configuration.machines[self.machineName]
     self.assertEquals(len(myMachine.states), 2)
     self.assertEquals(myMachine.states[self.initialStateName].name, self.initialStateName)
     self.assertEquals(myMachine.states[self.finalStateName].name, self.finalStateName)
Esempio n. 6
0
 def test_rootUrlHasDefault(self):
     self.baseDict.pop(constants.ROOT_URL_ATTRIBUTE)
     configuration = config.Configuration(self.baseDict)
     self.assertEquals(configuration.rootUrl, constants.DEFAULT_ROOT_URL)
Esempio n. 7
0
 def test_rootUrlPassedToMachines(self):
     configuration = config.Configuration(self.baseDict)
     self.assertEquals(configuration.rootUrl, self.rootUrl)
     self.assertTrue(configuration.machines[self.machineName].url.startswith(self.rootUrl))