|
16 | 16 | import copy |
17 | 17 |
|
18 | 18 | from keystoneauth1 import exceptions as ks_exc |
| 19 | +from osc_lib import exceptions |
19 | 20 |
|
20 | 21 | from openstackclient.identity.v2_0 import project |
21 | 22 | from openstackclient.tests import fakes |
@@ -410,6 +411,26 @@ def test_project_set_no_options(self): |
410 | 411 |
|
411 | 412 | self.assertIsNone(result) |
412 | 413 |
|
| 414 | + def test_project_set_unexist_project(self): |
| 415 | + arglist = [ |
| 416 | + "unexist-project", |
| 417 | + ] |
| 418 | + verifylist = [ |
| 419 | + ('project', "unexist-project"), |
| 420 | + ('name', None), |
| 421 | + ('description', None), |
| 422 | + ('enable', False), |
| 423 | + ('disable', False), |
| 424 | + ('property', None), |
| 425 | + ] |
| 426 | + self.projects_mock.get.side_effect = exceptions.NotFound(None) |
| 427 | + self.projects_mock.find.side_effect = exceptions.NotFound(None) |
| 428 | + |
| 429 | + parsed_args = self.check_parser(self.cmd, arglist, verifylist) |
| 430 | + |
| 431 | + self.assertRaises( |
| 432 | + exceptions.CommandError, self.cmd.take_action, parsed_args) |
| 433 | + |
413 | 434 | def test_project_set_name(self): |
414 | 435 | arglist = [ |
415 | 436 | '--name', 'qwerty', |
@@ -604,6 +625,19 @@ def setUp(self): |
604 | 625 | # Get the command object to test |
605 | 626 | self.cmd = project.UnsetProject(self.app, None) |
606 | 627 |
|
| 628 | + def test_project_unset_no_options(self): |
| 629 | + arglist = [ |
| 630 | + identity_fakes.project_name, |
| 631 | + ] |
| 632 | + verifylist = [ |
| 633 | + ('project', identity_fakes.project_name), |
| 634 | + ] |
| 635 | + parsed_args = self.check_parser(self.cmd, arglist, verifylist) |
| 636 | + |
| 637 | + result = self.cmd.take_action(parsed_args) |
| 638 | + |
| 639 | + self.assertIsNone(result) |
| 640 | + |
607 | 641 | def test_project_unset_key(self): |
608 | 642 | arglist = [ |
609 | 643 | '--property', 'fee', |
|
0 commit comments