Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for coriolisclient.cli.* modules #81

Merged
merged 6 commits into from
May 21, 2024

Conversation

Cristi1324
Copy link
Contributor

This PR adds unit tests for coriolisclient.cli.* modules.

Comment on lines 4 to 7
from cliff import command
from cliff import lister
from cliff import show
from unittest import mock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cliff is a third-party package, while unittest is standard. Please separate their imports, and apply everywhere:

Suggested change
from cliff import command
from cliff import lister
from cliff import show
from unittest import mock
from unittest import mock
from cliff import command
from cliff import lister
from cliff import show

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply this to all the files. Other than that, this LGTM

Comment on lines 135 to 136
mock_get_parser.return_value.add_argument.assert_called_once_with(
'appliance_id', help="The appliance ID")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

mock_lic_status = mock.Mock()
self.mock_app.client_manager.coriolis.licensing.status = \
mock_lic_status
self.licensce.app = self.mock_app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

Comment on lines 183 to 184
mock_get_parser.return_value.add_argument.assert_called_once_with(
'appliance_id', help="The appliance ID")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

mock.sentinel.licence_pem_file
mock_licence = mock.Mock()
self.mock_app.client_manager.coriolis.licensing.register = mock_licence
self.licensce.app = self.mock_app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

Comment on lines 125 to 128
mock_get_parser.return_value.add_argument.assert_has_calls([
mock.call('appliance_id', help='The appliance ID'),
mock.call('reservation_id', help='The reservation ID')
])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

mock_licensing_reservations = mock.Mock()
self.mock_app.client_manager.coriolis.licensing_reservations = \
mock_licensing_reservations
self.reservation.app = self.mock_app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

Comment on lines 177 to 180
mock_get_parser.return_value.add_argument.assert_has_calls([
mock.call('appliance_id', help='The appliance ID'),
mock.call('reservation_id', help='The reservation ID')
])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

mock_licensing_reservations = mock.Mock()
self.mock_app.client_manager.coriolis.licensing_reservations = \
mock_licensing_reservations
self.reservation.app = self.mock_app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

mock_licensing_server = mock.Mock()
self.mock_app.client_manager.coriolis.licensing_server = \
mock_licensing_server
self.server.app = self.mock_app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

@Cristi1324 Cristi1324 force-pushed the add_cli_unit_tests branch 2 times, most recently from 9c9883b to d51305f Compare April 24, 2024 14:37

def setUp(self):
super(LicensingStatusFormatterTestCase, self).setUp()
self.licensce = licensing.LicensingStatusFormatter()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change licensce to either licence or license :D Here, and everywhere else

@Dany9966 Dany9966 merged commit f83538e into cloudbase:master May 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants