-
Notifications
You must be signed in to change notification settings - Fork 14
Add unit tests for coriolisclient.v1.* modules
#86
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
Conversation
Dany9966
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly unnecessary mocks. Please fix
| @mock.patch.object(common, 'encode_base64_param') | ||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't need mocking. I'd prefer real test examples please
| @mock.patch.object(endpoint_destination_options. | ||
| EndpointDestinationOptionsManager, '_list') | ||
| @mock.patch.object(common, 'encode_base64_param') | ||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| @mock.patch.object(endpoint_instances.EndpointInstanceManager, '_list') | ||
| @mock.patch.object(urlparse, 'urlencode') | ||
| @mock.patch.object(common, 'encode_base64_param') | ||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
|
|
||
| @mock.patch.object(endpoint_instances.EndpointInstanceManager, '_get') | ||
| @mock.patch.object(common, 'encode_base64_param') | ||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
|
|
||
| @mock.patch.object(endpoint_networks.EndpointNetworkManager, '_list') | ||
| @mock.patch.object(common, 'encode_base64_param') | ||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
| mock_post.assert_called_once_with( | ||
| '/endpoints', expected_data, 'endpoint') | ||
|
|
||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| mock_put.assert_called_once_with( | ||
| '/endpoints/sentinel.id', expected_data, 'endpoint') | ||
|
|
||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| ) | ||
| mock_delete.assert_called_once_with('/endpoints/sentinel.id') | ||
|
|
||
| @mock.patch.object(base, 'getid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| @mock.patch.object(endpoints.EndpointManager, '_get_endpoint_id_for_name') | ||
| @mock.patch.object(utils, 'validate_uuid_string') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| ) | ||
|
|
||
| @mock.patch.object(endpoints.EndpointManager, 'list') | ||
| @mock.patch.object(utils, 'validate_uuid_string') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
b4af9d6 to
42e9086
Compare
| {"env": "mock_env"}, | ||
| ["option1", "option2"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add keyword arg names
| {"env": "mock_env"}, | |
| ["option1", "option2"] | |
| environment={"env": "mock_env"}, | |
| option_names=["option1", "option2"] |
| {"env": "mock_env"}, | ||
| ["option1", "option2"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| result = self.endpoint.get( | ||
| mock_endpoint, | ||
| "mock_id", | ||
| {"env": "mock_env"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| {"env": "mock_env"}, | |
| env={"env": "mock_env"}, |
| ValueError, | ||
| self.endpoint.get, | ||
| mock_endpoint, | ||
| "mock_env", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "mock_env", | |
| "mock_instance_id", |
|
|
||
| result = self.endpoint.list( | ||
| mock_endpoint, | ||
| {"env": "mock_env"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| {"env": "mock_env"}, | ||
| ["option1", "option2"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| {"env": "mock_env"}, | ||
| ["option1", "option2"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
|
||
| result = self.endpoint.list( | ||
| mock_endpoint, | ||
| {"env": "mock_env"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
|
||
| result = self.endpoint.get_default( | ||
| mock_endpoint, | ||
| {"env": "mock_env"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| } | ||
| ) | ||
|
|
||
| def test_flavor_name(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
| def test_flavor_name(self): | |
| def test_connection_info(self): |
…l_options` module
42e9086 to
c2c816b
Compare
This PR adds unit tests for
coriolisclient.v1.common...endpointsmodules.