2828
2929from openstackclient .compute .v2 import server
3030from openstackclient .tests .unit .compute .v2 import fakes as compute_fakes
31+ from openstackclient .tests .unit .identity .v3 import fakes as identity_fakes
3132from openstackclient .tests .unit .image .v2 import fakes as image_fakes
3233from openstackclient .tests .unit .network .v2 import fakes as network_fakes
3334from openstackclient .tests .unit import utils
@@ -4548,9 +4549,21 @@ class TestListMigrationV280(TestListMigration):
45484549 'Old Flavor' , 'New Flavor' , 'Type' , 'Created At' , 'Updated At'
45494550 ]
45504551
4552+ project = identity_fakes .FakeProject .create_one_project ()
4553+ user = identity_fakes .FakeUser .create_one_user ()
4554+
45514555 def setUp (self ):
45524556 super (TestListMigrationV280 , self ).setUp ()
45534557
4558+ self .projects_mock = self .app .client_manager .identity .projects
4559+ self .projects_mock .reset_mock ()
4560+
4561+ self .users_mock = self .app .client_manager .identity .users
4562+ self .users_mock .reset_mock ()
4563+
4564+ self .projects_mock .get .return_value = self .project
4565+ self .users_mock .get .return_value = self .user
4566+
45544567 self .app .client_manager .compute .api_version = api_versions .APIVersion (
45554568 '2.80' )
45564569
@@ -4561,15 +4574,15 @@ def test_server_migration_list_with_project(self):
45614574 '--marker' , 'test_kp' ,
45624575 '--changes-since' , '2019-08-07T08:03:25Z' ,
45634576 '--changes-before' , '2019-08-09T08:03:25Z' ,
4564- '--project' , '0c2accde-644a-45fa-8c10-e76debc7fbc3'
4577+ '--project' , self . project . id
45654578 ]
45664579 verifylist = [
45674580 ('status' , 'migrating' ),
45684581 ('limit' , 1 ),
45694582 ('marker' , 'test_kp' ),
45704583 ('changes_since' , '2019-08-07T08:03:25Z' ),
45714584 ('changes_before' , '2019-08-09T08:03:25Z' ),
4572- ('project_id ' , '0c2accde-644a-45fa-8c10-e76debc7fbc3' )
4585+ ('project ' , self . project . id )
45734586 ]
45744587 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
45754588 columns , data = self .cmd .take_action (parsed_args )
@@ -4580,7 +4593,7 @@ def test_server_migration_list_with_project(self):
45804593 'limit' : 1 ,
45814594 'marker' : 'test_kp' ,
45824595 'host' : None ,
4583- 'project_id' : '0c2accde-644a-45fa-8c10-e76debc7fbc3' ,
4596+ 'project_id' : self . project . id ,
45844597 'changes_since' : '2019-08-07T08:03:25Z' ,
45854598 'changes_before' : "2019-08-09T08:03:25Z" ,
45864599 }
@@ -4605,7 +4618,7 @@ def test_get_migrations_with_project_pre_v280(self):
46054618 verifylist = [
46064619 ('status' , 'migrating' ),
46074620 ('changes_before' , '2019-08-09T08:03:25Z' ),
4608- ('project_id ' , '0c2accde-644a-45fa-8c10-e76debc7fbc3' )
4621+ ('project ' , '0c2accde-644a-45fa-8c10-e76debc7fbc3' )
46094622 ]
46104623 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
46114624 ex = self .assertRaises (
@@ -4623,15 +4636,15 @@ def test_server_migration_list_with_user(self):
46234636 '--marker' , 'test_kp' ,
46244637 '--changes-since' , '2019-08-07T08:03:25Z' ,
46254638 '--changes-before' , '2019-08-09T08:03:25Z' ,
4626- '--user' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6'
4639+ '--user' , self . user . id ,
46274640 ]
46284641 verifylist = [
46294642 ('status' , 'migrating' ),
46304643 ('limit' , 1 ),
46314644 ('marker' , 'test_kp' ),
46324645 ('changes_since' , '2019-08-07T08:03:25Z' ),
46334646 ('changes_before' , '2019-08-09T08:03:25Z' ),
4634- ('user_id ' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6' )
4647+ ('user ' , self . user . id ),
46354648 ]
46364649 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
46374650 columns , data = self .cmd .take_action (parsed_args )
@@ -4642,7 +4655,7 @@ def test_server_migration_list_with_user(self):
46424655 'limit' : 1 ,
46434656 'marker' : 'test_kp' ,
46444657 'host' : None ,
4645- 'user_id' : 'dd214878-ca12-40fb-b035-fa7d2c1e86d6' ,
4658+ 'user_id' : self . user . id ,
46464659 'changes_since' : '2019-08-07T08:03:25Z' ,
46474660 'changes_before' : "2019-08-09T08:03:25Z" ,
46484661 }
@@ -4662,12 +4675,12 @@ def test_get_migrations_with_user_pre_v280(self):
46624675 arglist = [
46634676 '--status' , 'migrating' ,
46644677 '--changes-before' , '2019-08-09T08:03:25Z' ,
4665- '--user' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6'
4678+ '--user' , self . user . id ,
46664679 ]
46674680 verifylist = [
46684681 ('status' , 'migrating' ),
46694682 ('changes_before' , '2019-08-09T08:03:25Z' ),
4670- ('user_id ' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6' )
4683+ ('user ' , self . user . id ),
46714684 ]
46724685 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
46734686 ex = self .assertRaises (
@@ -4684,16 +4697,16 @@ def test_server_migration_list_with_project_and_user(self):
46844697 '--limit' , '1' ,
46854698 '--changes-since' , '2019-08-07T08:03:25Z' ,
46864699 '--changes-before' , '2019-08-09T08:03:25Z' ,
4687- '--project' , '0c2accde-644a-45fa-8c10-e76debc7fbc3' ,
4688- '--user' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6'
4700+ '--project' , self . project . id ,
4701+ '--user' , self . user . id ,
46894702 ]
46904703 verifylist = [
46914704 ('status' , 'migrating' ),
46924705 ('limit' , 1 ),
46934706 ('changes_since' , '2019-08-07T08:03:25Z' ),
46944707 ('changes_before' , '2019-08-09T08:03:25Z' ),
4695- ('project_id ' , '0c2accde-644a-45fa-8c10-e76debc7fbc3' ),
4696- ('user_id ' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6' )
4708+ ('project ' , self . project . id ),
4709+ ('user ' , self . user . id ),
46974710 ]
46984711 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
46994712 columns , data = self .cmd .take_action (parsed_args )
@@ -4703,8 +4716,8 @@ def test_server_migration_list_with_project_and_user(self):
47034716 'status' : 'migrating' ,
47044717 'limit' : 1 ,
47054718 'host' : None ,
4706- 'project_id' : '0c2accde-644a-45fa-8c10-e76debc7fbc3' ,
4707- 'user_id' : 'dd214878-ca12-40fb-b035-fa7d2c1e86d6' ,
4719+ 'project_id' : self . project . id ,
4720+ 'user_id' : self . user . id ,
47084721 'changes_since' : '2019-08-07T08:03:25Z' ,
47094722 'changes_before' : "2019-08-09T08:03:25Z" ,
47104723 }
@@ -4727,14 +4740,14 @@ def test_get_migrations_with_project_and_user_pre_v280(self):
47274740 arglist = [
47284741 '--status' , 'migrating' ,
47294742 '--changes-before' , '2019-08-09T08:03:25Z' ,
4730- '--project' , '0c2accde-644a-45fa-8c10-e76debc7fbc3' ,
4731- '--user' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6'
4743+ '--project' , self . project . id ,
4744+ '--user' , self . user . id ,
47324745 ]
47334746 verifylist = [
47344747 ('status' , 'migrating' ),
47354748 ('changes_before' , '2019-08-09T08:03:25Z' ),
4736- ('project_id ' , '0c2accde-644a-45fa-8c10-e76debc7fbc3' ),
4737- ('user_id ' , 'dd214878-ca12-40fb-b035-fa7d2c1e86d6' )
4749+ ('project ' , self . project . id ),
4750+ ('user ' , self . user . id )
47384751 ]
47394752 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
47404753 ex = self .assertRaises (
0 commit comments