def test_process_permissions(self):
        for permissions in (0o644, '0644', '0o644', 420, 420.1):
            self.assertEqual(420,
                             write_files._convert_permissions(permissions))

        response = write_files._convert_permissions(mock.sentinel.invalid)
        self.assertEqual(write_files.DEFAULT_PERMISSIONS, response)
    def test_process_permissions(self):
        for permissions in (0o644, '0644', '0o644', 420, 420.1):
            self.assertEqual(
                420, write_files._convert_permissions(permissions))

        response = write_files._convert_permissions(mock.sentinel.invalid)
        self.assertEqual(write_files.DEFAULT_PERMISSIONS, response)
    def test_process_permissions(self):
        for permissions in (0o644, '0644', '0o644', 420, 420.1):
            self.assertEqual(
                420, write_files._convert_permissions(permissions))

        with testutils.LogSnatcher('cloudbaseinit.plugins.common.'
                                   'userdataplugins.cloudconfigplugins.'
                                   'write_files') as snatcher:
            response = write_files._convert_permissions(mock.sentinel.invalid)

        expected_logging = [
            'Fail to process permissions %s, assuming 420'
            % mock.sentinel.invalid
        ]
        self.assertEqual(expected_logging, snatcher.output)
        self.assertEqual(write_files.DEFAULT_PERMISSIONS, response)
    def test_process_permissions(self):
        for permissions in (0o644, '0644', '0o644', 420, 420.1):
            self.assertEqual(420,
                             write_files._convert_permissions(permissions))

        with testutils.LogSnatcher('cloudbaseinit.plugins.common.'
                                   'userdataplugins.cloudconfigplugins.'
                                   'write_files') as snatcher:
            response = write_files._convert_permissions(mock.sentinel.invalid)

        expected_logging = [
            'Fail to process permissions %s, assuming 420' %
            mock.sentinel.invalid
        ]
        self.assertEqual(expected_logging, snatcher.output)
        self.assertEqual(write_files.DEFAULT_PERMISSIONS, response)