def test_disable_no_motd(self):
     """puppet:Disable with no motd update parses correctly"""
     # This is the same as the test_disable test
     expected = ["puppet agent --disable --color=false"]
     params = {
         'hosts': ['testhost.example.com'],
         'command': 'puppet',
         'subcommand': 'Disable',
         'motd': False
     }
     (update, cmd) = ppt._parse_Disable(params, self.app_logger)
     self.assertEqual(cmd, expected)
    def test_disable_custom_motd(self):
        """puppet:Disable with custom motd update parses correctly"""

        # FIXME
        #expected = ["""echo "custom message" >> /etc/motd && puppet agent --disable --color=false"""]
        expected = ["""puppet agent --disable --color=false"""]
        params = {
            'hosts': ['testhost.example.com'],
            'command': 'puppet',
            'subcommand': 'Disable',
            'motd': 'custom message'
        }
        (update, cmd) = ppt._parse_Disable(params, self.app_logger)
        self.assertEqual(cmd, expected)
    def test_disable_custom_motd_with_date(self):
        """puppet:Disable with custom motd with date update parses correctly"""
        with mock.patch('replugin.funcworker.puppet.dt') as (
                dt):
            dt.now.return_value = NOW

            # FIXME
            #expected = ["""echo "custom message %s" >> /etc/motd && puppet agent --disable --color=false""" % NOW]
            expected = ["""puppet agent --disable --color=false"""]
            params = {
                'hosts': ['testhost.example.com'],
                'command': 'puppet',
                'subcommand': 'Disable',
                'motd': 'custom message %s'
            }
            (update, cmd) = ppt._parse_Disable(params, self.app_logger)
            self.assertEqual(cmd, expected)