imjoseangel / powerline-k8sstatus

A Powerline segment for showing the status of a K8s context
MIT License
2 stars 0 forks source link

Add hypothesis tests for kubernetes #32

Closed imjoseangel closed 3 years ago

imjoseangel commented 3 years ago

SUMMARY

Fixes #11

ISSUE TYPE

COMPONENT NAME

Add Hypothesis for kubernetes config file

ADDITIONAL INFORMATION

@given(config_file=st.none())
def test_fuzz_list_kube_config_contexts(config_file):
    kubernetes.config.kube_config.list_kube_config_contexts(
        config_file=config_file)

@given(
    config_file=st.none(),
    context=st.none(),
    client_configuration=st.none(),
    persist_config=st.booleans(),
)
def test_fuzz_load_kube_config(
    config_file, context, client_configuration, persist_config
):
    kubernetes.config.kube_config.load_kube_config(
        config_file=config_file,
        context=context,
        client_configuration=client_configuration,
        persist_config=persist_config,
    )

@given(config_file=st.none(), context=st.none(), persist_config=st.booleans())
def test_fuzz_new_client_from_config(config_file, context, persist_config):
    kubernetes.config.kube_config.new_client_from_config(
        config_file=config_file, context=context, persist_config=persist_config
    )
imjoseangel commented 3 years ago

it doesn't make sense to continue with this PR as it is trying to Mocking Kubernetes and not the segment itself.