def test_run_enable(self): """puppet:Run with agent enable raises""" params = { 'hosts': ['testhost.example.com'], 'command': 'puppet', 'subcommand': 'Run', 'enable': True } with self.assertRaises(ValueError): (update, cmd) = ppt._parse_Run(params, self.app_logger)
def test_run_tags(self): """puppet:Run with tags parses correctly""" expected = ["puppet agent --test --tags tag1 tag2 tag3 --color=false"] params = { 'hosts': ['testhost.example.com'], 'command': 'puppet', 'subcommand': 'Run', 'tags': ['tag1', 'tag2', 'tag3'] } (update, cmd) = ppt._parse_Run(params, self.app_logger) self.assertEqual(cmd, expected)
def test_run_server(self): """puppet:Run with specific server params parses correctly""" expected = ["puppet agent --test --server puppetmaster01.example.com --color=false"] params = { 'hosts': ['testhost.example.com'], 'command': 'puppet', 'subcommand': 'Run', 'server': 'puppetmaster01.example.com' } (update, cmd) = ppt._parse_Run(params, self.app_logger) self.assertEqual(cmd, expected)
def test_run_noop(self): """puppet:Run with noop param parses correctly""" expected = ["puppet agent --test --noop --color=false"] params = { 'hosts': ['testhost.example.com'], 'command': 'puppet', 'subcommand': 'Run', 'noop': True } (update, cmd) = ppt._parse_Run(params, self.app_logger) self.assertEqual(cmd, expected)