diff --git a/kqueen/test_kubeapi.py b/kqueen/test_kubeapi.py new file mode 100644 index 00000000..112f9621 --- /dev/null +++ b/kqueen/test_kubeapi.py @@ -0,0 +1,23 @@ +from kqueen.kubeapi import KubernetesAPI + +import pytest + + +class TestKubeApi: + def test_missing_cluster_param(self): + with pytest.raises(ValueError, match='Missing parameter cluster'): + KubernetesAPI() + + def test_get_kubeconfig(self, cluster): + """Test get_kubeconfig returns YAML""" + + cluster.save() + api = KubernetesAPI(cluster=cluster) + print(api.get_kubeconfig_file()) + + def test_init(self, cluster): + cluster.save() + + api = KubernetesAPI(cluster=cluster) + + assert hasattr(api, 'cluster') diff --git a/kqueen/test_models.py b/kqueen/test_models.py index 0ebd5eb7..7d141ff5 100644 --- a/kqueen/test_models.py +++ b/kqueen/test_models.py @@ -4,7 +4,6 @@ from pprint import pprint import pytest -import json class TestModelMethods: diff --git a/kubeconfig_localhost b/kubeconfig_localhost new file mode 100644 index 00000000..af3b7873 --- /dev/null +++ b/kubeconfig_localhost @@ -0,0 +1,13 @@ +apiVersion: v1 +clusters: +- cluster: + server: http://127.0.0.1:8080 + name: local +contexts: +- context: + cluster: local + user: "" + name: local +current-context: local +kind: Config +preferences: {}