# Path: katprep/exceptions.py
# class EmptySetException(Exception):
#     """
#     Dummy class for empty result sets
# 
#     .. class:: EmptySetException
#     """
# 
# class InvalidCredentialsException(Exception):
#     """
#     Dummy class for invalid credentials
# 
#     .. class:: InvalidCredentialsException
#     """
# 
# class SessionException(Exception):
#     """
#     Dummy class for session errors
# 
#     .. class:: SessionException
#     """
# 
# Path: tests/utilities.py
# def load_config(config_file):
#     if not os.path.isfile(config_file):
#         pytest.skip("Please create configuration file %s!" % config_file)
# 
#     try:
#         with open(config_file, "r") as json_file:
#             return json.load(json_file)
#     except IOError as err:
#         pytest.skip("Unable to read configuration file: '%s'", err)


import logging
import pytest
from katprep.exceptions import (EmptySetException,
InvalidCredentialsException, SessionException)
from .utilities import load_config

    return LibvirtClient.LibvirtClient(
        logging.ERROR,
        config["config"]["uri"],
        config["config"]["api_user"],
        config["config"]["api_pass"]
    )


def test_invalid_login(config):
    """
    Ensure exceptions on invalid logins
    """
    LibvirtClient = pytest.importorskip("katprep.clients.LibvirtClient")

    with pytest.raises(InvalidCredentialsException):
        LibvirtClient.LibvirtClient(
            logging.ERROR,
            config["config"]["uri"],
            "giertz", "paulapinkepank"
        )

        # TODO: make a call?
        # api_dummy.get_vm_ips


def test_create_snapshot_fail(virtClient, nonexisting_vm, snapshot_name):
    """
    Ensure that creating snapshots of non-existing VMs is not possible
    """

# Path: katprep/exceptions.py
# class EmptySetException(Exception):
#     """
#     Dummy class for empty result sets
# 
#     .. class:: EmptySetException
#     """
# 
# class InvalidCredentialsException(Exception):
#     """
#     Dummy class for invalid credentials
# 
#     .. class:: InvalidCredentialsException
#     """
# 
# class SessionException(Exception):
#     """
#     Dummy class for session errors
# 
#     .. class:: SessionException
#     """
# 
# Path: tests/utilities.py
# def load_config(config_file):
#     if not os.path.isfile(config_file):
#         pytest.skip("Please create configuration file %s!" % config_file)
# 
#     try:
#         with open(config_file, "r") as json_file:
#             return json.load(json_file)
#     except IOError as err:
#         pytest.skip("Unable to read configuration file: '%s'", err)


# Path: tests/test_LibvirtClient.py
import logging
import pytest
from katprep.exceptions import (EmptySetException,
InvalidCredentialsException, SessionException)
from .utilities import load_config


    return LibvirtClient.LibvirtClient(
        logging.ERROR,
        config["config"]["uri"],
        config["config"]["api_user"],
        config["config"]["api_pass"]
    )


def test_invalid_login(config):
    """
    Ensure exceptions on invalid logins
    """
    LibvirtClient = pytest.importorskip("katprep.clients.LibvirtClient")

    with pytest.raises(InvalidCredentialsException):
        LibvirtClient.LibvirtClient(
            logging.ERROR,
            config["config"]["uri"],
            "giertz", "paulapinkepank"
        )

        # TODO: make a call?
        # api_dummy.get_vm_ips


def test_create_snapshot_fail(virtClient, nonexisting_vm, snapshot_name):
    """
    Ensure that creating snapshots of non-existing VMs is not possible
    """

    with pytest.raises(SessionException):