  def testPodGetNode(self, mock_k8s_api):
    """Test that the returned node of a pod is correct."""
    mock_pod = k8s_mocks.V1Pod(
        name='fake-pod-name',
        namespace='fake-namespace',
        node_name='fake-node-name')
    mock_k8s_api_func = mock_k8s_api.return_value.read_namespaced_pod
    mock_k8s_api_func.return_value = mock_pod

    node = base.K8sPod(
        k8s_mocks.MOCK_API_CLIENT, 'fake-pod-name', 'fake-namespace').GetNode()

    # Assert API and corresponding function was called appropriately
    mock_k8s_api.assert_called_with(k8s_mocks.MOCK_API_CLIENT)
    mock_k8s_api_func.assert_called()
    self.assertEqual(('fake-pod-name', 'fake-namespace'),
                     mock_k8s_api_func.call_args.args)
    # Assert returned pods correspond to provided response
    self.assertEqual('fake-node-name', node.name)
Test that the returned node of a pod is correct.
tests/providers/kubernetes/test_base.py