Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #8081 from aljazkosir/refactor_nuage_fixture
Browse files Browse the repository at this point in the history
[1LP][RFR] Refarctor Nuage fixture
  • Loading branch information
izapolsk authored Nov 7, 2018
2 parents 604ce73 + d7c0029 commit f9b558f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cfme/fixtures/nuage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from cfme.utils.log import logger


@pytest.fixture
def with_nuage_sandbox(networks_provider):
nuage = networks_provider.mgmt
sandbox = box = {}
def create_basic_sandbox(nuage):
box = {}

# Create empty enterprise aka 'sandbox'.
enterprise = box['enterprise'] = nuage.create_enterprise()
Expand Down Expand Up @@ -45,9 +43,18 @@ def with_nuage_sandbox(networks_provider):
box['l2_group'] = box['l2_domain'].create_child(
nuage.vspk.NUPolicyGroup(name=random_name()))[0]

return box


@pytest.fixture
def with_nuage_sandbox(networks_provider):
nuage = networks_provider.mgmt
sandbox = create_basic_sandbox(nuage)

# Let integration test do whatever it needs to do.
yield sandbox

# Destroy the sandbox.
enterprise = sandbox['enterprise']
nuage.delete_enterprise(enterprise)
logger.info('Destroyed sandbox enterprise {} ({})'.format(enterprise.name, enterprise.id))

0 comments on commit f9b558f

Please sign in to comment.