Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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