forked from ungleich-public/cdist
		
	Merge remote-tracking branch 'steven/master'
This commit is contained in:
		
				commit
				
					
						5a29875fcf
					
				
			
		
					 2 changed files with 18 additions and 12 deletions
				
			
		| 
						 | 
					@ -51,6 +51,11 @@ class Object(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Constants for use with Object.state
 | 
				
			||||||
 | 
					    STATE_PREPARED = "prepared"
 | 
				
			||||||
 | 
					    STATE_RUNNING = "running"
 | 
				
			||||||
 | 
					    STATE_DONE = "done"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def list_objects(cls, object_base_path, type_base_path):
 | 
					    def list_objects(cls, object_base_path, type_base_path):
 | 
				
			||||||
        """Return a list of object instances"""
 | 
					        """Return a list of object instances"""
 | 
				
			||||||
| 
						 | 
					@ -125,8 +130,7 @@ class Object(object):
 | 
				
			||||||
    parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path))
 | 
					    parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path))
 | 
				
			||||||
    explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path))
 | 
					    explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path))
 | 
				
			||||||
    changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed"))
 | 
					    changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed"))
 | 
				
			||||||
    prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared"))
 | 
					    state = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "state"))
 | 
				
			||||||
    ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran"))
 | 
					 | 
				
			||||||
    source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source"))
 | 
					    source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source"))
 | 
				
			||||||
    code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_local_path))
 | 
					    code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_local_path))
 | 
				
			||||||
    code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_remote_path))
 | 
					    code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_remote_path))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -79,6 +79,7 @@ class ObjectTestCase(unittest.TestCase):
 | 
				
			||||||
        self.cdist_object.source = []
 | 
					        self.cdist_object.source = []
 | 
				
			||||||
        self.cdist_object.code_local = ''
 | 
					        self.cdist_object.code_local = ''
 | 
				
			||||||
        self.cdist_object.code_remote = ''
 | 
					        self.cdist_object.code_remote = ''
 | 
				
			||||||
 | 
					        self.cdist_object.state = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_name(self):
 | 
					    def test_name(self):
 | 
				
			||||||
        self.assertEqual(self.cdist_object.name, '__third/moon')
 | 
					        self.assertEqual(self.cdist_object.name, '__third/moon')
 | 
				
			||||||
| 
						 | 
					@ -149,19 +150,20 @@ class ObjectTestCase(unittest.TestCase):
 | 
				
			||||||
        self.cdist_object.changed = True
 | 
					        self.cdist_object.changed = True
 | 
				
			||||||
        self.assertTrue(self.cdist_object.changed)
 | 
					        self.assertTrue(self.cdist_object.changed)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_prepared(self):
 | 
					    def test_state(self):
 | 
				
			||||||
        self.assertFalse(self.cdist_object.prepared)
 | 
					        self.assertEqual(self.cdist_object.state, '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_prepared_after_changing(self):
 | 
					    def test_state_prepared(self):
 | 
				
			||||||
        self.cdist_object.prepared = True
 | 
					        self.cdist_object.state = core.Object.STATE_PREPARED
 | 
				
			||||||
        self.assertTrue(self.cdist_object.prepared)
 | 
					        self.assertEqual(self.cdist_object.state, core.Object.STATE_PREPARED)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ran(self):
 | 
					    def test_state_running(self):
 | 
				
			||||||
        self.assertFalse(self.cdist_object.ran)
 | 
					        self.cdist_object.state = core.Object.STATE_RUNNING
 | 
				
			||||||
 | 
					        self.assertEqual(self.cdist_object.state, core.Object.STATE_RUNNING)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ran_after_changing(self):
 | 
					    def test_state_done(self):
 | 
				
			||||||
        self.cdist_object.ran = True
 | 
					        self.cdist_object.state = core.Object.STATE_DONE
 | 
				
			||||||
        self.assertTrue(self.cdist_object.ran)
 | 
					        self.assertEqual(self.cdist_object.state, core.Object.STATE_DONE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_source(self):
 | 
					    def test_source(self):
 | 
				
			||||||
        self.assertEqual(list(self.cdist_object.source), [])
 | 
					        self.assertEqual(list(self.cdist_object.source), [])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue