def test_00_main_create_lun(self): """Test main with arguments to use create_lun function""" parser = create_parser() serverfile = os.path.join(HERE, 'serverOS86.yml') lunscreatefile = os.path.join(HERE, 'test_create_lun.csv') args = parser.parse_args( ['-s', serverfile, '-f', lunscreatefile, '-c']) main(args) if not hasattr(sys.stdout, "getvalue"): self.fail("need to run in buffered mode") output = sys.stdout.getvalue().strip().split( "\n")[:-2] # remove (duration) self.assertEqual(output, CREATEOUTPUT.split("\n")[:-2])
def test_01_main_list_lun(self): """Test main with arguments to use list_lun function""" parser = create_parser() serverfile = os.path.join(HERE, 'serverOS87.yml') lunscreatefile = os.path.join(HERE, 'test_create_lun.csv') args = parser.parse_args( ['-s', serverfile, '-f', lunscreatefile, '-l']) main(args) if not hasattr(sys.stdout, "getvalue"): self.fail("need to run in buffered mode") output = sys.stdout.getvalue().strip().split( "\n")[3][:62] # just part of the line self.assertEqual(output, LISTOUTPUT)