X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Fplugins%2Frwstagingmgr%2Ftest%2Futest_staging_store.py;h=33bb9d889fb0bb048d8c7dc6e67657bbb64db730;hb=a3bb91f092d378448cb870eccd45d43865de143c;hp=eb71aa39de82c1aeaab6920435201a473ba7bb69;hpb=07b439824b5eac4dc760ce56b52fbdcf5539db4c;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwstagingmgr/test/utest_staging_store.py b/rwlaunchpad/plugins/rwstagingmgr/test/utest_staging_store.py index eb71aa39..33bb9d88 100755 --- a/rwlaunchpad/plugins/rwstagingmgr/test/utest_staging_store.py +++ b/rwlaunchpad/plugins/rwstagingmgr/test/utest_staging_store.py @@ -27,6 +27,7 @@ import unittest import xmlrunner from rift.tasklets.rwstagingmgr.store import StagingFileStore +from rift.mano.utils.project import ManoProject, DEFAULT_PROJECT import gi gi.require_version('RwStagingMgmtYang', '1.0') @@ -34,6 +35,18 @@ from gi.repository import ( RwStagingMgmtYang, ) +class MockTasklet(object): + def __init__(self): + self.log = logging.getLogger() + self.projects = {} + project = ManoProject(self.log, name=DEFAULT_PROJECT) + project.publisher = None + self.projects[project.name] = project + + def set_delegate(self, store): + self.projects[DEFAULT_PROJECT].publisher = store + + class TestSerializer(unittest.TestCase): def test_staging_area_create(self): @@ -44,7 +57,8 @@ class TestSerializer(unittest.TestCase): """ tmp_dir = tempfile.mkdtemp() - store = StagingFileStore(root_dir=tmp_dir) + tasklet = MockTasklet() + store = StagingFileStore(tasklet, root_dir=tmp_dir) mock_model = RwStagingMgmtYang.StagingArea.from_dict({}) stg = store.create_staging_area(mock_model) @@ -63,7 +77,8 @@ class TestSerializer(unittest.TestCase): """ tmp_dir = tempfile.mkdtemp() - store = StagingFileStore(root_dir=tmp_dir) + tasklet = MockTasklet() + store = StagingFileStore(tasklet, root_dir=tmp_dir) mock_model = RwStagingMgmtYang.StagingArea.from_dict({}) # get the wrapped mock model