Matthew Treinish | 0301bc8 | 2014-03-14 21:37:56 +0000 | [diff] [blame] | 1 | # 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 | |
| 16 | import mock |
Matthew Treinish | 0301bc8 | 2014-03-14 21:37:56 +0000 | [diff] [blame] | 17 | |
| 18 | from tempest.common.utils import file_utils |
| 19 | from tempest.tests import base |
| 20 | |
| 21 | |
| 22 | class TestFileUtils(base.TestCase): |
| 23 | |
| 24 | def test_have_effective_read_path(self): |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 25 | with mock.patch('__builtin__.open', mock.mock_open(), create=True): |
Matthew Treinish | 0301bc8 | 2014-03-14 21:37:56 +0000 | [diff] [blame] | 26 | 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) |