@@ -7267,6 +7267,10 @@ def test_tagged_interface_attach(self, mock_attach, mock_record):
72677267 mock_record .assert_called_once_with (
72687268 self .context , instance , instance_actions .ATTACH_INTERFACE )
72697269
7270+ @mock .patch (
7271+ 'nova.context.RequestContext.elevated' ,
7272+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7273+ )
72707274 @mock .patch (
72717275 'nova.network.neutron.API.has_extended_resource_request_extension' ,
72727276 new = mock .Mock (return_value = False ),
@@ -7292,10 +7296,15 @@ def test_attach_interface_qos_aware_port_old_compute(
72927296 self .context , instance ,
72937297 'foo_net_id' , 'foo_port_id' , None
72947298 )
7295- mock_show_port .assert_called_once_with (self .context , 'foo_port_id' )
7299+ mock_show_port .assert_called_once_with (
7300+ mock .sentinel .admin_context , 'foo_port_id' )
72967301 mock_get_service .assert_called_once_with (
72977302 self .context , instance .host , 'nova-compute' )
72987303
7304+ @mock .patch (
7305+ 'nova.context.RequestContext.elevated' ,
7306+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7307+ )
72997308 @mock .patch (
73007309 'nova.network.neutron.API.has_extended_resource_request_extension' ,
73017310 new = mock .Mock (return_value = False )
@@ -7326,14 +7335,18 @@ def test_attach_interface_qos_aware_port(
73267335 mock .sentinel .port_id , mock .sentinel .ip , mock .sentinel .tag )
73277336
73287337 mock_show_port .assert_called_once_with (
7329- self . context , mock .sentinel .port_id )
7338+ mock . sentinel . admin_context , mock .sentinel .port_id )
73307339 mock_get_service .assert_called_once_with (
73317340 self .context , instance .host , 'nova-compute' )
73327341 mock_attach .assert_called_once_with (
73337342 self .context , instance = instance , network_id = mock .sentinel .net_id ,
73347343 port_id = mock .sentinel .port_id , requested_ip = mock .sentinel .ip ,
73357344 tag = mock .sentinel .tag )
73367345
7346+ @mock .patch (
7347+ 'nova.context.RequestContext.elevated' ,
7348+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7349+ )
73377350 @mock .patch (
73387351 'nova.network.neutron.API.has_extended_resource_request_extension' ,
73397352 new = mock .Mock (return_value = True ),
@@ -7367,10 +7380,15 @@ def test_attach_interface_extended_qos_port_old_compute(
73677380 self .context , instance ,
73687381 'foo_net_id' , 'foo_port_id' , None
73697382 )
7370- mock_show_port .assert_called_once_with (self .context , 'foo_port_id' )
7383+ mock_show_port .assert_called_once_with (
7384+ mock .sentinel .admin_context , 'foo_port_id' )
73717385 mock_get_service .assert_called_once_with (
73727386 self .context , instance .host , 'nova-compute' )
73737387
7388+ @mock .patch (
7389+ 'nova.context.RequestContext.elevated' ,
7390+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7391+ )
73747392 @mock .patch (
73757393 'nova.network.neutron.API.has_extended_resource_request_extension' ,
73767394 new = mock .Mock (return_value = True )
@@ -7404,7 +7422,7 @@ def test_attach_interface_extended_qos_port(
74047422 mock .sentinel .port_id , mock .sentinel .ip , mock .sentinel .tag )
74057423
74067424 mock_show_port .assert_called_once_with (
7407- self . context , mock .sentinel .port_id )
7425+ mock . sentinel . admin_context , mock .sentinel .port_id )
74087426 mock_get_service .assert_called_once_with (
74097427 self .context , instance .host , 'nova-compute' )
74107428 mock_attach .assert_called_once_with (
0 commit comments