def test_can_select_nodes_without_label(cl, client, has_conf):
    has_conf.return_value = False
    v1 = MagicMock()
    v1.list_node.return_value = io.BytesIO(
        json.dumps({"hey": "there"}).encode('utf-8'))
    client.CoreV1Api.return_value = v1

    resp = get_nodes()
    v1.list_node.assert_called_with(_preload_content=False)
    assert resp == {"hey": "there"}
def test_can_select_nodes_by_label(cl, client, has_conf):
    has_conf.return_value = False
    v1 = MagicMock()
    v1.list_node.return_value = io.BytesIO(
        json.dumps({"hey": "there"}).encode('utf-8'))
    client.CoreV1Api.return_value = v1

    label_selector = 'beta.kubernetes.io/instance-type=m5.large'
    resp = get_nodes(label_selector=label_selector)
    v1.list_node.assert_called_with(
        label_selector=label_selector, _preload_content=False)
    assert resp == {"hey": "there"}