Skip to content

Commit

Permalink
unit test kubectl
Browse files Browse the repository at this point in the history
  • Loading branch information
kwmonroe committed Feb 17, 2024
1 parent c42c3cd commit f7f9224
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/unit/test_kubectl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from unittest.mock import patch

import kubectl


def test_kubectl():
"""Verify kubectl uses the appropriate kubeconfig files."""
int_cfg = "--kubeconfig=/root/.kube/config"
ext_cfg = "--kubeconfig=/home/ubuntu/config"

with patch("kubectl.check_output") as mock:
kubectl.kubectl()
assert int_cfg in mock.call_args.args[0]

with patch("kubectl.check_output") as mock:
kubectl.kubectl(external=True)
assert ext_cfg in mock.call_args.args[0]

0 comments on commit f7f9224

Please sign in to comment.