示例#1
0
 def test_parser(self):
     args = parse_args(['fittings.yaml', 'build', 'web'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'build')
     self.assertEqual(args.blueprints, ['web'])
     self.assertEqual(args.facilities, None)
     args = parse_args(['fittings.yaml', 'build', 'web', '-d'])
     self.assertEqual(
         logging.getLogger().getEffectiveLevel(), logging.DEBUG)
     args = parse_args(['fittings.yaml', 'build', 'web', '-q'])
     self.assertEqual(
         logging.getLogger().getEffectiveLevel(), logging.WARNING)
     args = parse_args(['fittings.yaml', 'start', '@NA12'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'start')
     self.assertEqual(args.blueprints, None)
     self.assertEqual(args.facilities, ['NA12'])
     args = parse_args([
         'fittings.yaml', 'rub', 'web', 'sql', '@NA9', '@NA12'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'rub')
     self.assertEqual(args.blueprints, ['web', 'sql'])
     self.assertEqual(args.facilities, ['NA9', 'NA12'])
     args = parse_args([
         'fittings.yaml', 'rub', 'web', '@NA9', 'sql', '@NA12'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'rub')
     self.assertEqual(args.blueprints, ['web', 'sql'])
     self.assertEqual(args.facilities, ['NA9', 'NA12'])
     args = parse_args(['fittings.yaml', 'polish'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'polish')
     self.assertEqual(args.blueprints, None)
     self.assertEqual(args.facilities, None)
示例#2
0
 def test_parser(self):
     with self.assertRaises(SystemExit):
         args = parse_args(['bad args'])
     with self.assertRaises(SystemExit):
         args = parse_args(['fittings.yaml'])
     args = parse_args(['fittings.yaml', 'build', 'web'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'build')
     self.assertEqual(args.blueprints, ['web'])
     self.assertEqual(args.facilities, None)
     args = parse_args(['fittings.yaml', 'start', '@NA12'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'start')
     self.assertEqual(args.blueprints, None)
     self.assertEqual(args.facilities, ['NA12'])
     args = parse_args(
         ['fittings.yaml', 'rub', 'web', 'sql', '@NA9', '@NA12'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'rub')
     self.assertEqual(args.blueprints, ['web', 'sql'])
     self.assertEqual(args.facilities, ['NA9', 'NA12'])
     args = parse_args(['fittings.yaml', 'polish'])
     self.assertEqual(args.fittings, 'fittings.yaml')
     self.assertEqual(args.action, 'polish')
     self.assertEqual(args.blueprints, None)
     self.assertEqual(args.facilities, None)
示例#3
0
    def test_parser(self):

        args = parse_args(['fittings.yaml', 'build', 'web'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'build')
        self.assertEqual(args.blueprints, ['web'])
        self.assertEqual(args.facilities, None)

        args = parse_args(
            ['fittings.yaml', 'build', 'web', '-p', 'parameters.yaml'])
        self.assertEqual(args.parameters, ['parameters.yaml'])

        args = parse_args(
            ['fittings.yaml', 'build', 'web', '-p', 'parameters.yaml', '-s'])
        self.assertEqual(args.parameters, ['parameters.yaml'])
        self.assertEqual(args.safe, True)

        args = parse_args(
            ['fittings.yaml', 'build', 'web', '-p', 'parameters.yaml', '-d'])
        self.assertEqual(args.parameters, ['parameters.yaml'])
        self.assertEqual(args.debug, True)

        args = parse_args(['fittings.yaml', 'build', 'web', '-s'])
        self.assertEqual(args.safe, True)

        args = parse_args(['fittings.yaml', 'build', 'web', '-d'])
        self.assertEqual(args.debug, True)
        self.assertEqual(
            plogging.getEffectiveLevel(), logging.DEBUG)

        args = parse_args(['fittings.yaml', 'build', 'web', '-q'])
        self.assertEqual(args.quiet, True)
        self.assertEqual(
            plogging.getEffectiveLevel(), logging.WARNING)

        args = parse_args(['fittings.yaml', 'start', '@NA12'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'start')
        self.assertEqual(args.blueprints, None)
        self.assertEqual(args.facilities, ['NA12'])

        args = parse_args([
            'fittings.yaml', 'prepare', 'web', 'sql', '@NA9', '@NA12'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'prepare')
        self.assertEqual(args.blueprints, ['web', 'sql'])
        self.assertEqual(args.facilities, ['NA9', 'NA12'])

        args = parse_args([
            'fittings.yaml', 'prepare', 'web', '@NA9', 'sql', '@NA12'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'prepare')
        self.assertEqual(args.blueprints, ['web', 'sql'])
        self.assertEqual(args.facilities, ['NA9', 'NA12'])

        args = parse_args(['fittings.yaml', 'polish'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'polish')
        self.assertEqual(args.blueprints, None)
        self.assertEqual(args.facilities, None)
示例#4
0
    def test_parser(self):

        args = parse_args(['fittings.yaml', 'build', 'web'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'build')
        self.assertEqual(args.blueprints, ['web'])
        self.assertEqual(args.facilities, None)

        args = parse_args(
            ['fittings.yaml', 'build', 'web', '-p', 'parameters.yaml'])
        self.assertEqual(args.parameters, ['parameters.yaml'])

        args = parse_args(
            ['fittings.yaml', 'build', 'web', '-p', 'parameters.yaml', '-s'])
        self.assertEqual(args.parameters, ['parameters.yaml'])
        self.assertEqual(args.safe, True)

        args = parse_args(
            ['fittings.yaml', 'build', 'web', '-p', 'parameters.yaml', '-d'])
        self.assertEqual(args.parameters, ['parameters.yaml'])
        self.assertEqual(args.debug, True)

        args = parse_args(['fittings.yaml', 'build', 'web', '-s'])
        self.assertEqual(args.safe, True)

        args = parse_args(['fittings.yaml', 'build', 'web', '-d'])
        self.assertEqual(args.debug, True)
        self.assertEqual(plogging.getEffectiveLevel(), logging.DEBUG)

        args = parse_args(['fittings.yaml', 'build', 'web', '-q'])
        self.assertEqual(args.quiet, True)
        self.assertEqual(plogging.getEffectiveLevel(), logging.WARNING)

        args = parse_args(['fittings.yaml', 'start', '@NA12'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'start')
        self.assertEqual(args.blueprints, None)
        self.assertEqual(args.facilities, ['NA12'])

        args = parse_args(
            ['fittings.yaml', 'prepare', 'web', 'sql', '@NA9', '@NA12'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'prepare')
        self.assertEqual(args.blueprints, ['web', 'sql'])
        self.assertEqual(args.facilities, ['NA9', 'NA12'])

        args = parse_args(
            ['fittings.yaml', 'prepare', 'web', '@NA9', 'sql', '@NA12'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'prepare')
        self.assertEqual(args.blueprints, ['web', 'sql'])
        self.assertEqual(args.facilities, ['NA9', 'NA12'])

        args = parse_args(['fittings.yaml', 'polish'])
        self.assertEqual(args.fittings, 'fittings.yaml')
        self.assertEqual(args.action, 'polish')
        self.assertEqual(args.blueprints, None)
        self.assertEqual(args.facilities, None)