  def testNodeListPods(self, mock_k8s_api):
    """Test that pods on a node are correctly listed."""

    # Create and assign mocks
    mock_pods = k8s_mocks.V1PodList(5)
    mock_k8s_api_func = mock_k8s_api.return_value.list_pod_for_all_namespaces
    mock_k8s_api_func.return_value = mock_pods

    pods = base.K8sNode(k8s_mocks.MOCK_API_CLIENT, 'fake-node-name').ListPods()

    # 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()
    kwargs = mock_k8s_api_func.call_args.kwargs
    self.assertIn('field_selector', kwargs)
    self.assertIn('fake-node-name', kwargs['field_selector'])
    # Assert returned pods correspond to provided response
    self.assertEqual(
        set(pod.name for pod in pods),
        set(pod.metadata.name for pod in mock_pods.items))
Test that pods on a node are correctly listed.
tests/providers/kubernetes/test_base.py