"""
Fixtures to manipulate with volume types and QoS Specs.

@author: schipiga@mirantis.com
"""

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest

from horizon_autotests.steps import VolumeTypesSteps

from ._utils import AttrDict, generate_ids

__all__ = [
    'qos_spec',
    'volume_type',
    'volume_types_steps'
]


@pytest.fixture
def volume_types_steps(horizon, login):
    """Get volume types steps.

    Arguments:
        - login: log in before tests.
        - horizon: application for steps.
    """
    return VolumeTypesSteps(horizon)


@pytest.yield_fixture
def volume_type(volume_types_steps):
    """Create volume type.

    Arguments:
        - volume_types_steps: in order to create volume type.
    """
    name = next(generate_ids('volume-type'))

    volume_types_steps.create_volume_type(name)
    _volume_type = AttrDict(name=name)

    yield _volume_type

    volume_types_steps.delete_volume_type(_volume_type.name)


@pytest.yield_fixture
def qos_spec(volume_types_steps):
    """Create QoS Spec.

    Arguments:
        - volume_types_steps: in order to create QoS Spec.
    """
    name = next(generate_ids('qos-spec'))

    volume_types_steps.create_qos_spec(name)
    _qos_spec = AttrDict(name=name)

    yield _qos_spec

    volume_types_steps.delete_qos_spec(_qos_spec.name)

f53c980ecbb07113f825f48bd6d6c2050ec59e5f
<mask token>


@pytest.yield_fixture
def volume_type(volume_types_steps):
    """Create volume type.

    Arguments:
        - volume_types_steps: in order to create volume type.
    """
    name = next(generate_ids('volume-type'))
    volume_types_steps.create_volume_type(name)
    _volume_type = AttrDict(name=name)
    yield _volume_type
    volume_types_steps.delete_volume_type(_volume_type.name)


<mask token>

<mask token>


@pytest.fixture
def volume_types_steps(horizon, login):
    """Get volume types steps.

    Arguments:
        - login: log in before tests.
        - horizon: application for steps.
    """
    return VolumeTypesSteps(horizon)


@pytest.yield_fixture
def volume_type(volume_types_steps):
    """Create volume type.

    Arguments:
        - volume_types_steps: in order to create volume type.
    """
    name = next(generate_ids('volume-type'))
    volume_types_steps.create_volume_type(name)
    _volume_type = AttrDict(name=name)
    yield _volume_type
    volume_types_steps.delete_volume_type(_volume_type.name)


@pytest.yield_fixture
def qos_spec(volume_types_steps):
    """Create QoS Spec.

    Arguments:
        - volume_types_steps: in order to create QoS Spec.
    """
    name = next(generate_ids('qos-spec'))
    volume_types_steps.create_qos_spec(name)
    _qos_spec = AttrDict(name=name)
    yield _qos_spec
    volume_types_steps.delete_qos_spec(_qos_spec.name)

<mask token>
__all__ = ['qos_spec', 'volume_type', 'volume_types_steps']


@pytest.fixture
def volume_types_steps(horizon, login):
    """Get volume types steps.

    Arguments:
        - login: log in before tests.
        - horizon: application for steps.
    """
    return VolumeTypesSteps(horizon)


@pytest.yield_fixture
def volume_type(volume_types_steps):
    """Create volume type.

    Arguments:
        - volume_types_steps: in order to create volume type.
    """
    name = next(generate_ids('volume-type'))
    volume_types_steps.create_volume_type(name)
    _volume_type = AttrDict(name=name)
    yield _volume_type
    volume_types_steps.delete_volume_type(_volume_type.name)


@pytest.yield_fixture
def qos_spec(volume_types_steps):
    """Create QoS Spec.

    Arguments:
        - volume_types_steps: in order to create QoS Spec.
    """
    name = next(generate_ids('qos-spec'))
    volume_types_steps.create_qos_spec(name)
    _qos_spec = AttrDict(name=name)
    yield _qos_spec
    volume_types_steps.delete_qos_spec(_qos_spec.name)

<mask token>
import pytest
from horizon_autotests.steps import VolumeTypesSteps
from ._utils import AttrDict, generate_ids
__all__ = ['qos_spec', 'volume_type', 'volume_types_steps']


@pytest.fixture
def volume_types_steps(horizon, login):
    """Get volume types steps.

    Arguments:
        - login: log in before tests.
        - horizon: application for steps.
    """
    return VolumeTypesSteps(horizon)


@pytest.yield_fixture
def volume_type(volume_types_steps):
    """Create volume type.

    Arguments:
        - volume_types_steps: in order to create volume type.
    """
    name = next(generate_ids('volume-type'))
    volume_types_steps.create_volume_type(name)
    _volume_type = AttrDict(name=name)
    yield _volume_type
    volume_types_steps.delete_volume_type(_volume_type.name)


@pytest.yield_fixture
def qos_spec(volume_types_steps):
    """Create QoS Spec.

    Arguments:
        - volume_types_steps: in order to create QoS Spec.
    """
    name = next(generate_ids('qos-spec'))
    volume_types_steps.create_qos_spec(name)
    _qos_spec = AttrDict(name=name)
    yield _qos_spec
    volume_types_steps.delete_qos_spec(_qos_spec.name)

"""
Fixtures to manipulate with volume types and QoS Specs.

@author: schipiga@mirantis.com
"""

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest

from horizon_autotests.steps import VolumeTypesSteps

from ._utils import AttrDict, generate_ids

__all__ = [
    'qos_spec',
    'volume_type',
    'volume_types_steps'
]


@pytest.fixture
def volume_types_steps(horizon, login):
    """Get volume types steps.

    Arguments:
        - login: log in before tests.
        - horizon: application for steps.
    """
    return VolumeTypesSteps(horizon)


@pytest.yield_fixture
def volume_type(volume_types_steps):
    """Create volume type.

    Arguments:
        - volume_types_steps: in order to create volume type.
    """
    name = next(generate_ids('volume-type'))

    volume_types_steps.create_volume_type(name)
    _volume_type = AttrDict(name=name)

    yield _volume_type

    volume_types_steps.delete_volume_type(_volume_type.name)


@pytest.yield_fixture
def qos_spec(volume_types_steps):
    """Create QoS Spec.

    Arguments:
        - volume_types_steps: in order to create QoS Spec.
    """
    name = next(generate_ids('qos-spec'))

    volume_types_steps.create_qos_spec(name)
    _qos_spec = AttrDict(name=name)

    yield _qos_spec

    volume_types_steps.delete_qos_spec(_qos_spec.name)
