示例#1
0
    def test_listAllSecretsWithLabels_custom(self, client_mock):
        service = KubernetesService()
        client_mock.reset_mock()

        labels = {"operated-by": "me", "heritage": "mongo", "name": "name"}
        result = service.listAllSecretsWithLabels(labels)
        expected_calls = [
            call.CoreV1Api().list_secret_for_all_namespaces(
                label_selector="operated-by=me,heritage=mongo,name=name")
        ]
        self.assertEqual(expected_calls, client_mock.mock_calls)
        self.assertEqual(
            client_mock.CoreV1Api().list_secret_for_all_namespaces.
            return_value, result)
示例#2
0
    def test_listAllSecretsWithLabels_default(self, client_mock):
        service = KubernetesService()
        client_mock.reset_mock()

        result = service.listAllSecretsWithLabels()
        expected_calls = [
            call.CoreV1Api().list_secret_for_all_namespaces(
                label_selector=
                "operated-by=operators.ultimaker.com,heritage=mongos")
        ]
        self.assertEqual(expected_calls, client_mock.mock_calls)
        self.assertEqual(
            client_mock.CoreV1Api().list_secret_for_all_namespaces.
            return_value, result)