@@ -34,10 +34,18 @@ def test_get_libvirt_params(self):
3434 )
3535 current_ctx .set (_ctx )
3636
37- self .assertEqual (common .get_libvirt_params (), (None , {}))
37+ with mock .patch (
38+ "cloudify_libvirt.common.uuid.uuid4" ,
39+ mock .Mock (return_value = "some_uuid" )
40+ ):
41+ self .assertEqual (common .get_libvirt_params (),
42+ (None , {'name' : 'node_name' ,
43+ 'instance_uuid' : 'some_uuid' }))
44+
3845 self .assertEqual (_ctx .instance .runtime_properties , {
3946 'libvirt_auth' : None ,
40- 'params' : {}
47+ 'params' : {'name' : 'node_name' ,
48+ 'instance_uuid' : 'some_uuid' }
4149 })
4250
4351 # overwrite
@@ -54,21 +62,32 @@ def test_get_libvirt_params(self):
5462 )
5563 current_ctx .set (_ctx )
5664
57- self .assertEqual (common .get_libvirt_params (
58- params = {'z' : 'y' }, libvirt_auth = {'w' : 'x' }
59- ), ({
60- 'w' : 'x'
61- }, {
62- 'a' : 'b' ,
63- 'c' : 'd' ,
64- 'e' : 'g' ,
65- 'z' : 'y'
66- })
67- )
65+ with mock .patch (
66+ "cloudify_libvirt.common.uuid.uuid4" ,
67+ mock .Mock (return_value = "some_uuid" )
68+ ):
69+ self .assertEqual (common .get_libvirt_params (
70+ params = {'z' : 'y' }, libvirt_auth = {'w' : 'x' }
71+ ), ({
72+ 'w' : 'x'
73+ }, {
74+ # default values
75+ 'instance_uuid' : 'some_uuid' ,
76+ 'name' : 'node_name' ,
77+ # combined
78+ 'a' : 'b' ,
79+ 'c' : 'd' ,
80+ 'e' : 'g' ,
81+ 'z' : 'y'
82+ })
83+ )
6884 self .assertEqual (_ctx .instance .runtime_properties , {
6985 'libvirt_auth' : {'w' : 'x' },
70- 'params' : {'a' : 'b' , 'c' : 'd' , 'e' : 'g' , 'z' : 'y' }
71- })
86+ 'params' : {
87+ # default values
88+ 'instance_uuid' : 'some_uuid' , 'name' : 'node_name' ,
89+ # combined
90+ 'a' : 'b' , 'c' : 'd' , 'e' : 'g' , 'z' : 'y' }})
7291
7392 def test_save_node_state (self ):
7493 isdir = mock .Mock (return_value = False )
0 commit comments