def test_mv(self):
     """fileops:Move with params parses correctly"""
     expected = ['mv /a/path/to/file /tmp/file']
     params = {
         'hosts': ['testhost.example.com'],
         'command': 'fileops',
         'subcommand': 'Touch',
         'path': '/a/path/to/file',
         'to': '/tmp/file'
     }
     (update, cmd) = fileops._parse_Move(params, self.app_logger)
     self.assertEqual(cmd, expected)
    def test_move_error_conditions(self):
        """fileops:Move verify error conditions"""

        # path as a list
        params = {
            'hosts': ['testhost.example.com'],
            'command': 'fileops',
            'subcommand': 'Move',
            'to': '/tmp/file',
            'path': ['/a/path/to/file'],
        }

        with self.assertRaises(TypeError):
            fileops._parse_Move(params, self.app_logger)

        # missing "to"
        params = {
            'hosts': ['testhost.example.com'],
            'command': 'fileops',
            'subcommand': 'Move',
            'path': '/a/path/to/file',
        }

        with self.assertRaises(TypeError):
            fileops._parse_Move(params, self.app_logger)

        # missing "path"
        params = {
            'hosts': ['testhost.example.com'],
            'command': 'fileops',
            'subcommand': 'Move',
            'to': '/tmp/file',
        }

        with self.assertRaises(TypeError):
            fileops._parse_Move(params, self.app_logger)