3 # Copyright (c) 2016 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # pylint: disable=missing-docstring,too-many-instance-attributes
12 """Tier and TestCase classes to wrap the testcases config file"""
22 def split_text(text, max_len):
27 if len(line) + len(word) < max_len - 1:
39 def __init__(self, name, order, description=""):
41 self.skipped_tests_array = []
44 self.description = description
46 def add_test(self, testcase):
47 self.tests_array.append(testcase)
49 def skip_test(self, testcase):
50 self.skipped_tests_array.append(testcase)
54 for test in self.tests_array:
55 array_tests.append(test)
58 def get_skipped_test(self):
59 return self.skipped_tests_array
61 def get_test_names(self):
63 for test in self.tests_array:
64 array_tests.append(test.get_name())
67 def get_test(self, test_name):
68 if self.is_test(test_name):
69 for test in self.tests_array + self.skipped_tests_array:
70 if test.get_name() == test_name:
74 def is_test(self, test_name):
75 for test in self.tests_array + self.skipped_tests_array:
76 if test.get_name() == test_name:
87 msg = prettytable.PrettyTable(
88 header_style='upper', padding_width=5,
89 field_names=['tiers', 'order', 'description',
92 [self.name, self.order,
93 textwrap.fill(self.description, width=40),
94 textwrap.fill(' '.join([str(x.get_name(
95 )) for x in self.get_tests()]), width=40)])
96 return msg.get_string()
101 def __init__(self, name, enabled, skipped, criteria, blocking,
102 description="", project=""):
103 # pylint: disable=too-many-arguments
105 self.enabled = enabled
106 self.skipped = skipped
107 self.criteria = criteria
108 self.blocking = blocking
109 self.description = description
110 self.project = project
115 def is_enabled(self):
118 def is_skipped(self):
121 def get_criteria(self):
124 def is_blocking(self):
127 def get_project(self):
131 msg = prettytable.PrettyTable(
132 header_style='upper', padding_width=5,
133 field_names=['test case', 'description', 'criteria'])
134 msg.add_row([self.name, textwrap.fill(self.description, width=40),
136 return msg.get_string()