Skip to content

Commit

Permalink
PEP8 of integration/smoke/test_vpc_vpn
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Andersen committed Jan 11, 2016
1 parent 96abf3c commit df609f4
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions test/integration/smoke/test_vpc_vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# Import Local Modules
from marvin.codes import PASS, FAILED
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import (cleanup_resources,
from marvin.lib.utils import (validateList,
cleanup_resources,
get_process_status)

from marvin.lib.base import (Domain,
Expand Down Expand Up @@ -259,7 +260,6 @@ def __init__(self):
}



class TestVpcRemoteAccessVpn(cloudstackTestCase):

@classmethod
Expand All @@ -286,8 +286,10 @@ def setUpClass(cls):

cls.hypervisor = testClient.getHypervisorInfo()

cls.logger.debug("Downloading Template: %s from: %s" %(cls.services["template"][cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower()], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
)], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
cls.template.download(cls.apiclient)

if cls.template == FAILED:
Expand Down Expand Up @@ -463,8 +465,10 @@ def setUpClass(cls):

cls.hypervisor = testClient.getHypervisorInfo()

cls.logger.debug("Downloading Template: %s from: %s" %(cls.services["template"][cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower()], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
)], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
cls.template.download(cls.apiclient)

if cls.template == FAILED:
Expand Down Expand Up @@ -530,11 +534,11 @@ def _validate_vpc_offering(self, vpc_offering):
self.apiclient,
id=vpc_offering.id
)
self.assertEqual(
isinstance(vpc_offs, list),
True,
"List VPC offerings should return a valid list"
)
offering_list = validateList(vpc_offs)
self.assertEqual(offering_list[0],
PASS,
"List VPC offerings should return a valid list"
)
self.assertEqual(
vpc_offering.name,
vpc_offs[0].name,
Expand Down Expand Up @@ -824,8 +828,10 @@ def setUpClass(cls):

cls.hypervisor = testClient.getHypervisorInfo()

cls.logger.debug("Downloading Template: %s from: %s" %(cls.services["template"][cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower()], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
)], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
cls.template.download(cls.apiclient)

if cls.template == FAILED:
Expand All @@ -845,11 +851,11 @@ def _validate_vpc_offering(self, vpc_offering):
self.apiclient,
id=vpc_offering.id
)
self.assertEqual(
isinstance(vpc_offs, list),
True,
"List VPC offerings should return a valid list"
)
offering_list = validateList(vpc_offs)
self.assertEqual(offering_list[0],
PASS,
"List VPC offerings should return a valid list"
)
self.assertEqual(
vpc_offering.name,
vpc_offs[0].name,
Expand All @@ -876,7 +882,6 @@ def _create_vpc_offering(self, offering_name):

return vpc_off


def _get_ssh_client(self, virtual_machine, services, retries):
""" Setup ssh client connection and return connection
vm requires attributes public_ip, public_port, username, password """
Expand Down Expand Up @@ -923,7 +928,6 @@ def _create_natrule(self, vpc, vm, public_port, private_port, public_ip, network
vm.public_port = int(public_port)
return nat_rule


@attr(tags=["advanced"], required_hardware="true")
def test_01_redundant_vpc_site2site_vpn(self):
"""Test Site 2 Site VPN Across redundant VPCs"""
Expand All @@ -936,8 +940,10 @@ def test_01_redundant_vpc_site2site_vpn(self):
networkOffering) > 0, "No VPC based network offering")

# Create and enable redundant VPC offering
redundant_vpc_offering = self._create_vpc_offering('redundant_vpc_offering')
self.assert_(redundant_vpc_offering is not None, "Failed to create redundant VPC Offering")
redundant_vpc_offering = self._create_vpc_offering(
'redundant_vpc_offering')
self.assert_(redundant_vpc_offering is not None,
"Failed to create redundant VPC Offering")

redundant_vpc_offering.update(self.apiclient, state='Enabled')

Expand Down

0 comments on commit df609f4

Please sign in to comment.