Esempio n. 1
0
    def test_create_cluster_proto(self, wait_mock, convert_mock):
        from google.cloud.container_v1.proto.cluster_service_pb2 import Cluster

        mock_cluster_proto = Cluster()
        mock_cluster_proto.name = CLUSTER_NAME

        retry_mock, timeout_mock = mock.Mock(), mock.Mock()

        client_create = self.gke_hook._client.create_cluster = mock.Mock()

        self.gke_hook.create_cluster(mock_cluster_proto, project_id=TEST_PROJECT_ID, retry=retry_mock,
                                     timeout=timeout_mock)

        client_create.assert_called_with(project_id=TEST_PROJECT_ID, zone=ZONE,
                                         cluster=mock_cluster_proto,
                                         retry=retry_mock, timeout=timeout_mock)
        wait_mock.assert_called_with(client_create.return_value)
        convert_mock.assert_not_called()
    def test_create_cluster_proto(self, wait_mock, convert_mock):
        from google.cloud.container_v1.proto.cluster_service_pb2 import Cluster

        mock_cluster_proto = Cluster()
        mock_cluster_proto.name = CLUSTER_NAME

        retry_mock, timeout_mock = mock.Mock(), mock.Mock()

        client_create = self.gke_hook._client.create_cluster = mock.Mock()

        self.gke_hook.create_cluster(mock_cluster_proto,
                                     project_id=TEST_GCP_PROJECT_ID,
                                     retry=retry_mock,
                                     timeout=timeout_mock)

        client_create.assert_called_with(project_id=TEST_GCP_PROJECT_ID,
                                         zone=GKE_ZONE,
                                         cluster=mock_cluster_proto,
                                         retry=retry_mock, timeout=timeout_mock)
        wait_mock.assert_called_with(client_create.return_value)
        convert_mock.assert_not_called()