# Path: libcloudforensics/providers/kubernetes/services.py
# class K8sService(base.K8sNamespacedResource):
#   def Delete(self, cascade: bool = True) -> None:
#   def Read(self) -> client.V1Service:
#   def Type(self) -> str:
#   def Labels(self) -> Dict[str, str]:
#   def GetCoveredPods(self) -> List[base.K8sPod]:
#   def ClusterIp(self) -> Optional[str]:
#   def ExternalIps(self) -> Optional[List[str]]:
# 
# Path: tests/providers/kubernetes/k8s_mocks.py
# MOCK_API_CLIENT = mock.Mock()
# def V1ObjectMeta(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     labels: Optional[Labels] = None) -> client.V1ObjectMeta:
# def V1NodeList(amount: int) -> client.V1NodeList:
# def V1PodList(amount: int) -> client.V1PodList:
# def V1NetworkPolicyList(
#     amount: int, namespace: str) -> client.V1NetworkPolicyList:
# def V1NetworkPolicy(name: str, namespace: str) -> client.V1NetworkPolicy:
# def V1Service(selector_labels: Labels) -> client.V1Service:
# def V1Node(name: str) -> client.V1Node:
# def V1Pod(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     node_name: Optional[str] = None,
#     labels: Optional[Labels] = None) -> client.V1Pod:
# def V1PodTemplateSpec(labels: Labels) -> client.V1PodTemplateSpec:
# def V1ReplicaSet(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     template_spec_labels: Optional[Labels] = None) -> client.V1ReplicaSet:
# def V1Deployment(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     template_spec_labels: Optional[Labels] = None,
#     match_labels: Optional[Labels] = None) -> client.V1Deployment:


import typing
import unittest
import mock
from kubernetes import client
from libcloudforensics.providers.kubernetes import services
from tests.providers.kubernetes import k8s_mocks
# -*- coding: utf-8 -*-
# Copyright 2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests on Kubernetes service objects."""




class K8sServiceTest(unittest.TestCase):
  """Test the K8sService methods."""

  @typing.no_type_check
  @mock.patch.object(client.CoreV1Api, 'list_namespaced_pod')
  def testListCoveredPods(self, list_namespaced_pod):
    """Test that GetCoveredPods calls API correctly and returns correctly."""
    mock_pods = k8s_mocks.V1PodList(4)
    list_namespaced_pod.return_value = mock_pods
    service = services.K8sService(

# Path: libcloudforensics/providers/kubernetes/services.py
# class K8sService(base.K8sNamespacedResource):
#   def Delete(self, cascade: bool = True) -> None:
#   def Read(self) -> client.V1Service:
#   def Type(self) -> str:
#   def Labels(self) -> Dict[str, str]:
#   def GetCoveredPods(self) -> List[base.K8sPod]:
#   def ClusterIp(self) -> Optional[str]:
#   def ExternalIps(self) -> Optional[List[str]]:
# 
# Path: tests/providers/kubernetes/k8s_mocks.py
# MOCK_API_CLIENT = mock.Mock()
# def V1ObjectMeta(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     labels: Optional[Labels] = None) -> client.V1ObjectMeta:
# def V1NodeList(amount: int) -> client.V1NodeList:
# def V1PodList(amount: int) -> client.V1PodList:
# def V1NetworkPolicyList(
#     amount: int, namespace: str) -> client.V1NetworkPolicyList:
# def V1NetworkPolicy(name: str, namespace: str) -> client.V1NetworkPolicy:
# def V1Service(selector_labels: Labels) -> client.V1Service:
# def V1Node(name: str) -> client.V1Node:
# def V1Pod(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     node_name: Optional[str] = None,
#     labels: Optional[Labels] = None) -> client.V1Pod:
# def V1PodTemplateSpec(labels: Labels) -> client.V1PodTemplateSpec:
# def V1ReplicaSet(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     template_spec_labels: Optional[Labels] = None) -> client.V1ReplicaSet:
# def V1Deployment(
#     name: Optional[str] = None,
#     namespace: Optional[str] = None,
#     template_spec_labels: Optional[Labels] = None,
#     match_labels: Optional[Labels] = None) -> client.V1Deployment:


# Path: tests/providers/kubernetes/test_services.py
import typing
import unittest
import mock
from kubernetes import client
from libcloudforensics.providers.kubernetes import services
from tests.providers.kubernetes import k8s_mocks

# -*- coding: utf-8 -*-
# Copyright 2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests on Kubernetes service objects."""




class K8sServiceTest(unittest.TestCase):
  """Test the K8sService methods."""

  @typing.no_type_check
  @mock.patch.object(client.CoreV1Api, 'list_namespaced_pod')
  def testListCoveredPods(self, list_namespaced_pod):
    """Test that GetCoveredPods calls API correctly and returns correctly."""
    mock_pods = k8s_mocks.V1PodList(4)
    list_namespaced_pod.return_value = mock_pods
    service = services.K8sService(

        k8s_mocks.MOCK_API_CLIENT, 'service-name', 'service-namespace')