def test_parsing_on_init(self): """Test if the arguments are parsed when the class is initialized""" args = [ '-u', 'jsmith', '-p', '1234', '-t', 'abcd', '--from-date', '2015-01-01' ] cmd = BackendCommand(*args) self.assertIsInstance(cmd.parsed_args, argparse.Namespace) self.assertEqual(cmd.parsed_args.backend_user, 'jsmith') self.assertEqual(cmd.parsed_args.backend_password, '1234') self.assertEqual(cmd.parsed_args.backend_token, 'abcd') self.assertEqual(cmd.parsed_args.from_date, '2015-01-01')
def test_argument_parser(self): """Test if it returns a argument parser object""" parser = BackendCommand.create_argument_parser() self.assertIsInstance(parser, argparse.ArgumentParser)
def test_setup_cmd_parser(self): """Test whether an NotImplementedError exception is thrown""" with self.assertRaises(NotImplementedError): BackendCommand.setup_cmd_parser()