Skip to content

Commit

Permalink
Skip appcenter test if no appcenter credentials given
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Smith committed Jan 18, 2017
1 parent f0a8f9f commit 08eb18e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/acitoolkit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
APPCENTER_CERT_NAME=''
APPCENTER_KEY=''
""")


MAX_RANDOM_STRING_SIZE = 20

Expand Down Expand Up @@ -2962,8 +2962,8 @@ def test_get_name_dn_delimiters(self):
"""
Test _get_name_dn_delimiters method
"""
self.assertEqual(OutsideNetwork._get_name_dn_delimiters(),
['/extsubnet-[', '/'])
self.assertEqual(OutsideNetwork._get_name_dn_delimiters(),
['/extsubnet-[', '/'])

def test_set_scope(self):
"""
Expand All @@ -2972,7 +2972,7 @@ def test_set_scope(self):
tenant = Tenant('cisco')
out_net = OutsideNetwork('OutsideNetwork', tenant)
out_net.set_addr('0.0.0.0/0')
valid_scopes = ['import-rtctrl', 'export-rtctrl', 'import-security',
valid_scopes = ['import-rtctrl', 'export-rtctrl', 'import-security',
'shared-security', 'shared-rtctrl']
for scope in valid_scopes:
out_net.set_scope(scope)
Expand All @@ -2997,9 +2997,9 @@ def test_get_json_detail(self):
out_net = OutsideNetwork(out_net_name, tenant)
out_net.set_addr(ip_add)
out_net_json = out_net.get_json()
self.assertEqual(ip_add,
self.assertEqual(ip_add,
out_net_json['l3extSubnet']['attributes']['ip'])
self.assertEqual(out_net_name,
self.assertEqual(out_net_name,
out_net_json['l3extSubnet']['attributes']['name'])

def test_get_json_detail_set_scope(self):
Expand All @@ -3011,12 +3011,12 @@ def test_get_json_detail_set_scope(self):
tenant = Tenant('cisco')
out_net = OutsideNetwork(out_net_name, tenant)
out_net.set_addr(ip_add)
valid_scopes = ['import-rtctrl', 'export-rtctrl', 'import-security',
valid_scopes = ['import-rtctrl', 'export-rtctrl', 'import-security',
'shared-security', 'shared-rtctrl']
for scope in valid_scopes:
out_net.set_scope(scope)
out_net_json = out_net.get_json()
self.assertEqual(scope,
self.assertEqual(scope,
out_net_json['l3extSubnet']['attributes']['scope'])


Expand Down Expand Up @@ -3229,6 +3229,7 @@ def test_get_with_params(self):
)
self.assertTrue(len(tenants) > 0)


class TestLiveAppcenterSubscription(unittest.TestCase):
"""
Certificate subscription tests with a live APIC
Expand All @@ -3239,12 +3240,13 @@ def login_to_apic(self):
"""Login to the APIC using Certificate auth with appcenter_user enabled
RETURNS: Instance of class Session
"""
session = Session(URL, APPCENTER_LOGIN, cert_name=APPCENTER_CERT_NAME,
key=APPCENTER_KEY, subscription_enabled=True, appcenter_user=True)
session = Session(URL, APPCENTER_LOGIN, cert_name=APPCENTER_CERT_NAME,
key=APPCENTER_KEY, subscription_enabled=True, appcenter_user=True)
resp = session.login()
self.assertTrue(resp.ok)
return session

@unittest.skipIf('APPCENTER_LOGIN' not in vars(), 'APPCENTER credentials not given.')
def test_get_actual_event(self):
"""
Test get_event for certificate based subscription
Expand Down Expand Up @@ -3289,8 +3291,6 @@ def test_get_actual_event(self):
data=new_tenant.get_json())
self.assertTrue(resp.ok)
Tenant.unsubscribe(session)




class TestLiveTenant(TestLiveAPIC):
Expand Down

0 comments on commit 08eb18e

Please sign in to comment.