3838 find_resource_id_from_relationship_by_type )
3939
4040
41+ class SpecialMockCloudifyContext (MockCloudifyContext ):
42+
43+ def __init__ (self , * args , ** kwargs ) -> None :
44+ super ().__init__ (* args , ** kwargs )
45+ setattr (self , 'properties' , kwargs .get ('properties' ))
46+ self ._plugin = mock .MagicMock (properties = {})
47+
48+ @property
49+ def plugin (self ):
50+ return self ._plugin
51+
52+
4153def get_mock_node_instance_context (** kwargs ):
4254 kwargs ['node_id' ] = kwargs .get ('node_id' , 'foo' )
4355 kwargs ['node_name' ] = kwargs .get ('node_id' , 'foo' )
@@ -55,7 +67,7 @@ def get_mock_node_instance_context(**kwargs):
5567 kwargs ['operation' ] = kwargs .get (
5668 'operation' ,
5769 {'name' : 'foo' , 'retry_number' : 0 })
58- _ctx = MockCloudifyContext (** kwargs )
70+ _ctx = SpecialMockCloudifyContext (** kwargs )
5971 _ctx .node .type_hierarchy = ['cloudify.nodes.Root' ,
6072 'cloudify.nodes.Compute' ,
6173 'cloudify.nodes.vcloud.VM' ]
@@ -109,7 +121,7 @@ def get_mock_relationship_context(**kwargs):
109121 kwargs ['operation' ] = kwargs .get (
110122 'operation' ,
111123 {'name' : 'foo' , 'retry_number' : 0 })
112- _ctx = MockCloudifyContext (** kwargs )
124+ _ctx = SpecialMockCloudifyContext (** kwargs )
113125 _ctx ._context = {'related' : kwargs .get ('related' , {'is_target' : False })}
114126 current_ctx .set (_ctx )
115127 return _ctx
0 commit comments