blob: 605e82a66f6a75ce6e3b3d441d4d0d3f2ff4ff11 [file] [log] [blame]
Matthew Treinish0301bc82014-03-14 21:37:56 +00001# Copyright 2014 IBM Corp.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import mock
Matthew Treinish0301bc82014-03-14 21:37:56 +000017
18from tempest.common.utils import file_utils
19from tempest.tests import base
20
21
22class TestFileUtils(base.TestCase):
23
24 def test_have_effective_read_path(self):
Matthew Treinish5c660ab2014-05-18 21:14:36 -040025 with mock.patch('__builtin__.open', mock.mock_open(), create=True):
Matthew Treinish0301bc82014-03-14 21:37:56 +000026 result = file_utils.have_effective_read_access('fake_path')
27 self.assertTrue(result)
28
29 def test_not_effective_read_path(self):
30 result = file_utils.have_effective_read_access('fake_path')
31 self.assertFalse(result)