Modify TestCase constructor attributes
[functest.git] / functest / opnfv_tests / openstack / snaps / health_check.py
1 # Copyright (c) 2015 All rights reserved
2 # This program and the accompanying materials
3 # are made available under the terms of the Apache License, Version 2.0
4 # which accompanies this distribution, and is available at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7
8 import unittest
9
10 from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
11     SnapsTestRunner
12 from functest.utils.constants import CONST
13
14 from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
15 from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck
16
17
18 class HealthCheck(SnapsTestRunner):
19     """
20     This test executes the SNAPS Python Test case SimpleHealthCheck which
21     creates a VM with a single port with an IPv4 address that is assigned by
22     DHCP. This test then validates the expected IP with the actual
23     """
24     def __init__(self, **kwargs):
25         if "case_name" not in kwargs:
26             kwargs["case_name"] = "snaps_health_check"
27         super(HealthCheck, self).__init__(**kwargs)
28
29         self.suite = unittest.TestSuite()
30
31         image_custom_config = None
32         if hasattr(CONST, 'snaps_health_check'):
33             image_custom_config = CONST.snaps_health_check
34
35         self.suite.addTest(
36             OSIntegrationTestCase.parameterize(
37                 SimpleHealthCheck, CONST.openstack_creds, self.ext_net_name,
38                 use_keystone=CONST.snaps_use_keystone,
39                 flavor_metadata=self.flavor_metadata,
40                 image_metadata=image_custom_config))