Skip to content

Commit

Permalink
Corrections on unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantinos-papadopoulos committed Mar 5, 2017
1 parent 66a3abb commit 525a832
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
24 changes: 12 additions & 12 deletions util/unittests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def setUp(self):
self.foot_output = '<p>testing</p></body></html>'
self.foot_input = '<p>testing</p>'

def test01_generate_html_foot(self):
def test_generate_html_foot(self):
"""Checks the generate_html_footl() method of util/html.py.
It checks the equality of the result of an input.
"""
Expand Down Expand Up @@ -62,7 +62,7 @@ def setUp(self):
'<!-- Here goes JavaScript -->',
'<!-- Here goes Header content -->')

def test01_generate_html_head(self):
def test_generate_html_head(self):
"""Checks the generate_html_headl() method of util/html.py.
It checks the equality of the result of an input.
"""
Expand Down Expand Up @@ -98,7 +98,7 @@ def setUpClass(cls):
cls.not_list_of_dictionaries = [1, 2, 'a', 3]
cls.noise = 'This_is_just_noise'

def test01_isalistofdictionaries(self):
def test_isalistofdictionaries(self):
"""Checks the isalistofdictionaries() method of
util/html.py. It checks the equality of the result of an input.
- in this case is checked the result, when the provided input is a
Expand All @@ -110,7 +110,7 @@ def test01_isalistofdictionaries(self):
('Testing isalistofdictionaries output. '
'Assert true'))

def test02_isalistofdictionaries(self):
def test_isalistofdictionaries(self):
"""Checks the isalistofdictionaries() method of
util/html.py. Checks the equality of the result of an input.
- in this case is checked the result, when the provided input is a
Expand All @@ -123,7 +123,7 @@ def test02_isalistofdictionaries(self):
('Testing isalistofdictionaries output. '
'Assert false 1'))

def test03_isalistofdictionaries(self):
def test_isalistofdictionaries(self):
"""Checks the isalistofdictionaries() method of
util/html.py. Checks the equality of the result of an input.
- in this case is checked the result, when the provided input is not
Expand Down Expand Up @@ -189,7 +189,7 @@ def setUpClass(cls):
cls.row_data2['result3'] = 900
cls.multy_dict_input.append([cls.row_data1, cls.row_data2])

def test01_multy_dict_to_html(self):
def test_multy_dict_to_html(self):
"""Tests the multy_dict_to_html() method of util/html.py.
It checks the equality of the result of an input.
- In this test case we are using only the compulsory arguments of the
Expand All @@ -202,7 +202,7 @@ def test01_multy_dict_to_html(self):
('Testing multy_dict_to_'
'html_multiline output test 2'))

def test02_multy_dict_to_html(self):
def test_multy_dict_to_html(self):
"""Tests the multy_dict_to_html() method of util/html.py.
It checks the equality of the result of an input. In this test case we
are using only the compulsory arguments of the method
Expand Down Expand Up @@ -248,7 +248,7 @@ def setUp(self):
'Test table',
self.data_row)

def test01_single_dict_to_html(self):
def test_single_dict_to_html(self):
"""
Method that tests the single_dict_to_html() method of util/html.py
It checks the equality of the result of an input.
Expand Down Expand Up @@ -283,15 +283,15 @@ def setUpClass(cls):
cls.map_dict['result3'] = 'switches'
cls.map_dict['result4'] = 'switches'

def test01_get_ordered_index(self):
def test_get_ordered_index(self):
"""Method that tests functionality of get_ordered_index() function
in case where it returns a valid index"""
self.assertEqual(1,
util.html.get_ordered_index('result3',
self.map_dict),
'Testing returned index when key exists.')

def test02_get_ordered_index(self):
def test_get_ordered_index(self):
"""Method that tests functionality of get_ordered_index() function
in case where it returns a invalid index (returns None)"""
self.assertEqual(-1, util.html.get_ordered_index('result33',
Expand Down Expand Up @@ -332,7 +332,7 @@ def setUpClass(cls):
cls.td_style = 'font-size:bold;'
cls.td_class = 'info'

def test_01_singledicttabledata(self):
def test_singledicttabledata(self):
"""
Method that tests single_dict_table_data() when data_values parameter
is a string value.
Expand All @@ -345,7 +345,7 @@ def test_01_singledicttabledata(self):
'Testing single_dict_table_data() '
'with a string input.')

def test_02_singledicttabledata(self):
def test_singledicttabledata(self):
"""
Method that tests single_dict_table_data() when data_values parameter
is a List of Dictionaries.
Expand Down
14 changes: 7 additions & 7 deletions util/unittests/test_netutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def setUpClass(cls):
logging.info('could not reach remote node: test cannot continue')

return -1
def test01_ssh_connection_open(self):
def test_ssh_connection_open(self):
"""ssh_connection_open() false "remote ip" provided
"""
logging.info('[netutil-test] remote address: {0} '.
Expand All @@ -93,15 +93,15 @@ def test01_ssh_connection_open(self):
self.assertIsNotNone(sftp)
util.netutil.ssh_connection_close(sftp, transport_layer)

def test02_ssh_connect_or_return(self):
def test_ssh_connect_or_return(self):
"""ssh_connect_or_return() check returned ssh object
"""
logging.info('[netutil-test] remote address: {0} '.
format(self.remote_node.ip))
self.assertIsNotNone(util.netutil.ssh_connect_or_return(
self.remote_node, self.constants_set.maxretries))

def test03_isdir(self):
def test_isdir(self):
"""testing isdir() with /tmp on localhost
"""
(sftp, transport_layer) = \
Expand All @@ -112,7 +112,7 @@ def test03_isdir(self):
sftp))
util.netutil.ssh_connection_close(sftp, transport_layer)

def test04_ssh_copy_file_to_target(self):
def test_ssh_copy_file_to_target(self):
"""ssh_copy_file_to_target() copying a local file to remote target
"""
subprocess.check_output("touch" + " " + 'fooDir/' +
Expand All @@ -131,7 +131,7 @@ def test04_ssh_copy_file_to_target(self):
localfile,
remotefile)

def test05_copy_dir_local_to_remote(self):
def test_copy_dir_local_to_remote(self):
"""copy_dir_local_to_remote(). copying a local directory to remote node
"""
util.netutil.copy_dir_local_to_remote(self.remote_node,self.localnodefilepath,
Expand All @@ -140,7 +140,7 @@ def test05_copy_dir_local_to_remote(self):
util.netutil.ssh_connection_open(self.remote_node)
self.assertTrue(util.netutil.isdir(self.file_paths_set.rem_node_path,
sftp))
def test06_create_dir_remote(self):
def test_create_dir_remote(self):
"""create_dir_remote(). creating directory to remote node
"""
remote_dir_create = self.file_paths_set.rem_node_path + \
Expand All @@ -150,7 +150,7 @@ def test06_create_dir_remote(self):
util.netutil.create_dir_remote(self.remote_node,
remote_dir_create)

def test07_ssh_connect_or_return2(self):
def test_ssh_connect_or_return2(self):
"""ssh_connect_or_return2() check returned ssh object
"""
logging.info('[netutil-test] remote address: {0} '.
Expand Down
12 changes: 6 additions & 6 deletions util/unittests/test_plot_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PlotJsonKeyErrorTests(unittest.TestCase):
module util/plot_json.py.
"""

def test01_errorbar(self):
def test_errorbar(self):
"""Checks the errorbar() method of util/plot_json.py.
It checks the case of invalid json input.
"""
Expand All @@ -28,7 +28,7 @@ def test01_errorbar(self):
['java_opts', 'controller'], 'errorbar.png',
None, None, 0, None)

def test02_errorbar_connected(self):
def test_errorbar_connected(self):
"""Checks the errorbar_connected() method of
util/plot_json.py. It checks the case of invalid json input.
"""
Expand All @@ -43,7 +43,7 @@ def test02_errorbar_connected(self):
None, None,
0, None)

def test03_scatter(self):
def test_scatter(self):
"""
Checks the scatter() method of util/plot_json.py.
It checks the case of invalid json input.
Expand All @@ -58,7 +58,7 @@ def test03_scatter(self):
['java_opts', 'controller'], 'errorbar.png',
None, None, 0, None)

def test04_multi_scatter(self):
def test_multi_scatter(self):
"""
Checks the multy_scatter() method of util/plot_json.py
It checks the case of invalid json input.
Expand All @@ -73,7 +73,7 @@ def test04_multi_scatter(self):
['java_opts', 'controller'], 'errorbar.png',
None, None, 0, None)

def test05_multi_errorbar(self):
def test_multi_errorbar(self):
"""
Checks the multi_errorbar() function of util/plot_json.py.
It checks the case of invalid json input.
Expand All @@ -88,7 +88,7 @@ def test05_multi_errorbar(self):
['java_opts', 'controller'], 'errorbar.png',
None, None, 0, None)

def test06_multi_errorbar_connected(self):
def test_multi_errorbar_connected(self):
"""
Method that checks the multi_errorbar_connected() function of
util/plot_json.py. It checks the case of invalid json input.
Expand Down
12 changes: 6 additions & 6 deletions util/unittests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def setUpClass(cls):
logging.getLogger().info('NOT OWNED PORT: %s', cls.port_not_owned)
cls.ssh_client = util.netutil.ssh_connect_or_return(NODE_CONNECTION, 10)

def test01_getpid_listeningonport(self):
def test_getpid_listeningonport(self):
"""Checks the getpid_listeningonport() function of
util/process.py module. Checks the equality between the known process
id of the initializes server, with the one returned from the function.
Expand All @@ -116,7 +116,7 @@ def test01_getpid_listeningonport(self):
'Testing the returned PID. Local')


def test02_getpid_listeningonport(self):
def test_getpid_listeningonport(self):
"""Checks the getpid_listeningonport() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function, a port number on which a process
Expand All @@ -132,7 +132,7 @@ def test02_getpid_listeningonport(self):
self.ssh_client),
'Testing when port is not owned. Remote')

def test03_getpid_listeningonport(self):
def test_getpid_listeningonport(self):
"""Checks the getpid_listeningonport() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function something that is not a port number.
Expand All @@ -147,7 +147,7 @@ def test03_getpid_listeningonport(self):
self.ssh_client),
'Testing with an invalid port. Remote')

def test01_is_process_running(self):
def test_is_process_running(self):
"""Checks the is_process_running() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function a valid process id.
Expand All @@ -158,7 +158,7 @@ def test01_is_process_running(self):
self.ssh_client),
'Testing true case for a valid process id. Remote')

def test02_is_process_running(self):
def test_is_process_running(self):
"""Checks the is_process_running() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function a invalid process id.
Expand All @@ -169,7 +169,7 @@ def test02_is_process_running(self):
self.ssh_client),
'Testing false case for invalid process id. Remote')

def test03_is_process_running(self):
def test_is_process_running(self):
"""Checks the is_process_running() function of
util/process.py module. In this scenario we check the result in case
we give as input to the function a invalid process id.
Expand Down
2 changes: 1 addition & 1 deletion util/unittests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def setUpClass(cls):
cls.stddev = math.sqrt(cls.variance)
cls.coefvariance = cls.stddev / cls.mean

def test01_mean(self):
def test_mean(self):
"""
Checks the mean() function of util/statutil.stats.py
module.
Expand Down
Loading

0 comments on commit 525a832

Please sign in to comment.