@@ -7267,6 +7267,10 @@ def test_tagged_interface_attach(self, mock_attach, mock_record):
7267
7267
mock_record .assert_called_once_with (
7268
7268
self .context , instance , instance_actions .ATTACH_INTERFACE )
7269
7269
7270
+ @mock .patch (
7271
+ 'nova.context.RequestContext.elevated' ,
7272
+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7273
+ )
7270
7274
@mock .patch (
7271
7275
'nova.network.neutron.API.has_extended_resource_request_extension' ,
7272
7276
new = mock .Mock (return_value = False ),
@@ -7292,10 +7296,15 @@ def test_attach_interface_qos_aware_port_old_compute(
7292
7296
self .context , instance ,
7293
7297
'foo_net_id' , 'foo_port_id' , None
7294
7298
)
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' )
7296
7301
mock_get_service .assert_called_once_with (
7297
7302
self .context , instance .host , 'nova-compute' )
7298
7303
7304
+ @mock .patch (
7305
+ 'nova.context.RequestContext.elevated' ,
7306
+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7307
+ )
7299
7308
@mock .patch (
7300
7309
'nova.network.neutron.API.has_extended_resource_request_extension' ,
7301
7310
new = mock .Mock (return_value = False )
@@ -7326,14 +7335,18 @@ def test_attach_interface_qos_aware_port(
7326
7335
mock .sentinel .port_id , mock .sentinel .ip , mock .sentinel .tag )
7327
7336
7328
7337
mock_show_port .assert_called_once_with (
7329
- self . context , mock .sentinel .port_id )
7338
+ mock . sentinel . admin_context , mock .sentinel .port_id )
7330
7339
mock_get_service .assert_called_once_with (
7331
7340
self .context , instance .host , 'nova-compute' )
7332
7341
mock_attach .assert_called_once_with (
7333
7342
self .context , instance = instance , network_id = mock .sentinel .net_id ,
7334
7343
port_id = mock .sentinel .port_id , requested_ip = mock .sentinel .ip ,
7335
7344
tag = mock .sentinel .tag )
7336
7345
7346
+ @mock .patch (
7347
+ 'nova.context.RequestContext.elevated' ,
7348
+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7349
+ )
7337
7350
@mock .patch (
7338
7351
'nova.network.neutron.API.has_extended_resource_request_extension' ,
7339
7352
new = mock .Mock (return_value = True ),
@@ -7367,10 +7380,15 @@ def test_attach_interface_extended_qos_port_old_compute(
7367
7380
self .context , instance ,
7368
7381
'foo_net_id' , 'foo_port_id' , None
7369
7382
)
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' )
7371
7385
mock_get_service .assert_called_once_with (
7372
7386
self .context , instance .host , 'nova-compute' )
7373
7387
7388
+ @mock .patch (
7389
+ 'nova.context.RequestContext.elevated' ,
7390
+ new = mock .Mock (return_value = mock .sentinel .admin_context )
7391
+ )
7374
7392
@mock .patch (
7375
7393
'nova.network.neutron.API.has_extended_resource_request_extension' ,
7376
7394
new = mock .Mock (return_value = True )
@@ -7404,7 +7422,7 @@ def test_attach_interface_extended_qos_port(
7404
7422
mock .sentinel .port_id , mock .sentinel .ip , mock .sentinel .tag )
7405
7423
7406
7424
mock_show_port .assert_called_once_with (
7407
- self . context , mock .sentinel .port_id )
7425
+ mock . sentinel . admin_context , mock .sentinel .port_id )
7408
7426
mock_get_service .assert_called_once_with (
7409
7427
self .context , instance .host , 'nova-compute' )
7410
7428
mock_attach .assert_called_once_with (
0 commit comments