def test_main_custom_context(monkeypatch, capsys, kubeconfig): monkeypatch.setattr( 'sys.stdin', io.StringIO('print(f"current context: {config.current_context}")')) main(['--kubeconfig', str(kubeconfig), '--context=other']) captured = capsys.readouterr() assert 'current context: other' in captured.out
def test_main_custom_context(monkeypatch, capsys, kubeconfig): monkeypatch.setattr( "sys.stdin", io.StringIO('print(f"current context: {config.current_context}")')) main(["--kubeconfig", str(kubeconfig), "--context=other"]) captured = capsys.readouterr() assert "current context: other" in captured.out
def test_main_script(monkeypatch, capsys, kubeconfig): monkeypatch.setattr('pykube.HTTPClient.version', ('1', '13')) main(['--kubeconfig', str(kubeconfig), '-c', 'api.version']) captured = capsys.readouterr() assert "('1', '13')\n" == captured.out
def test_main_script(monkeypatch, capsys, kubeconfig): monkeypatch.setattr("pykube.HTTPClient.version", ("1", "13")) main(["--kubeconfig", str(kubeconfig), "-c", "api.version"]) captured = capsys.readouterr() assert "('1', '13')\n" == captured.out