Esempio n. 1
0
 def test_unfindable_args_config_file(self):
     """
     Test unfindable config file
     """
     args = argparse.Namespace()
     args.config_file_name = "\b"
     args.template_file_name = __file__
     args.start_date = args.end_date = args.num_nodes = None
     with self.assertRaises(FileNotFoundError):
         yaml_gen.handle_args(args)
Esempio n. 2
0
 def test_handle_missing_end_date_arg(self):
     """
     Test the argument handler start range only
     """
     args = argparse.Namespace()
     args.start_date = "9999-12-31"
     args.template_file_name = __file__
     args.config_file_name = args.end_date = args.num_nodes = None
     args.random = False
     with self.assertRaises(yaml_gen.DateRangeArgsError):
         yaml_gen.handle_args(args)
Esempio n. 3
0
 def test_handle_args_date_range(self):
     """
     Test the argument handler start and end range
     """
     args = argparse.Namespace()
     args.start_date = "9999-12-31"
     args.end_date = "9999-12-31"
     args.template_file_name = __file__
     args.config_file_name = args.num_nodes = None
     args.provider = "ocp"
     args.random = False
     yaml_gen.handle_args(args)
     self.assertTrue(isinstance(args.start_date, date))
     self.assertTrue(isinstance(args.end_date, date))
Esempio n. 4
0
    def test_zero_num_nodes_arg(self):
        """
        Test zero num_nodes arg
        """
        args = argparse.Namespace()

        args.template_file_name = __file__
        args.start_date = args.end_date = args.config_file_name = None
        args.provider = "ocp"
        args.num_nodes = 0
        args = yaml_gen.handle_args(args)
        self.assertTrue(args.num_nodes is None)
Esempio n. 5
0
    def test_positive_num_nodes_arg(self):
        """
        Test positive num_nodes arg
        """
        args = argparse.Namespace()

        args.template_file_name = __file__
        args.num_nodes = 10
        args.start_date = args.end_date = args.config_file_name = None
        args.provider = "ocp"
        args = yaml_gen.handle_args(args)
        self.assertEqual(args.num_nodes, 10)