Added keyword for role create and delete#97
Added keyword for role create and delete#97rohini-nubolab wants to merge 50 commits intodevopsspiral:masterfrom
Conversation
| source = | ||
| src/ | ||
| [report] | ||
| fail_under = 84 |
There was a problem hiding this comment.
Please don't decrease coverage
src/KubeLibrary/KubeLibrary.py
Outdated
| """ | ||
| return [endpoints.metadata.name for endpoints in endpoints.items] | ||
|
|
||
| def get_role_details_in_namespace(self, name, namespace): |
There was a problem hiding this comment.
Name the functions same as Kubernetes python library function - in this case read_namespaced_role (see #75)
There was a problem hiding this comment.
Still you need to do it for create_role_in_namespace and delete_role_in_namespace
|
Complete checklist |
done |
| mock_lnp.side_effect = mock_create_role_in_namespace | ||
| kl = KubeLibrary(kube_config='test/resources/k3d') | ||
| name = 'pod-reader' | ||
| role_manifest = { |
There was a problem hiding this comment.
I believe this test has no value, we are not testing anything as everything is mocked. One thing that might be useful is testing handling situation when role is already created with some meaningful output.
| self.assertEqual('mytestlabel', cron_job_details.items.metadata.labels.TestLabel) | ||
|
|
||
| @mock.patch('kubernetes.client.RbacAuthorizationV1Api.delete_namespaced_role') | ||
| def test_delete_role_in_namespace(self, mock_lnp): |
There was a problem hiding this comment.
You could test handling situation when there is no role to remove. Other than that the mocked response is wrong because as I understand it will return V1 status.
Added keyword for role create and delete
Fixes #96