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
|
||||
def list_objects(cls, object_base_path, type_base_path):
|
||||
"""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))
|
||||
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"))
|
||||
prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared"))
|
||||
ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran"))
|
||||
state = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "state"))
|
||||
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_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.code_local = ''
|
||||
self.cdist_object.code_remote = ''
|
||||
self.cdist_object.state = ''
|
||||
|
||||
def test_name(self):
|
||||
self.assertEqual(self.cdist_object.name, '__third/moon')
|
||||
|
@ -149,19 +150,20 @@ class ObjectTestCase(unittest.TestCase):
|
|||
self.cdist_object.changed = True
|
||||
self.assertTrue(self.cdist_object.changed)
|
||||
|
||||
def test_prepared(self):
|
||||
self.assertFalse(self.cdist_object.prepared)
|
||||
def test_state(self):
|
||||
self.assertEqual(self.cdist_object.state, '')
|
||||
|
||||
def test_prepared_after_changing(self):
|
||||
self.cdist_object.prepared = True
|
||||
self.assertTrue(self.cdist_object.prepared)
|
||||
def test_state_prepared(self):
|
||||
self.cdist_object.state = core.Object.STATE_PREPARED
|
||||
self.assertEqual(self.cdist_object.state, core.Object.STATE_PREPARED)
|
||||
|
||||
def test_ran(self):
|
||||
self.assertFalse(self.cdist_object.ran)
|
||||
def test_state_running(self):
|
||||
self.cdist_object.state = core.Object.STATE_RUNNING
|
||||
self.assertEqual(self.cdist_object.state, core.Object.STATE_RUNNING)
|
||||
|
||||
def test_ran_after_changing(self):
|
||||
self.cdist_object.ran = True
|
||||
self.assertTrue(self.cdist_object.ran)
|
||||
def test_state_done(self):
|
||||
self.cdist_object.state = core.Object.STATE_DONE
|
||||
self.assertEqual(self.cdist_object.state, core.Object.STATE_DONE)
|
||||
|
||||
def test_source(self):
|
||||
self.assertEqual(list(self.cdist_object.source), [])
|
||||
|
|
Loading…
Reference in a new issue