aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-28 18:34:04 +0000
committerGerrit Code Review <review@openstack.org>2017-06-28 18:34:04 +0000
commitb500866531fa8bcae9ae09a6fe28de276e3e1724 (patch)
tree5572c766a14d5b8607978a1f11a11df29c5ee6e8 /tests
parente85e4d15423e4c56874888e27d4583658ce09da5 (diff)
parent748a056b0964e2abf93ad66951957c834a32b81b (diff)
downloadkolla-b500866531fa8bcae9ae09a6fe28de276e3e1724.tar.gz
kolla-b500866531fa8bcae9ae09a6fe28de276e3e1724.zip
Merge "Allow setting copied files group more precisely"
Diffstat (limited to 'tests')
-rw-r--r--tests/test_set_config.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/tests/test_set_config.py b/tests/test_set_config.py
index e67db9bc2..fa8e45301 100644
--- a/tests/test_set_config.py
+++ b/tests/test_set_config.py
@@ -10,7 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import collections
import copy
import imp
import json
@@ -117,23 +116,16 @@ class ConfigFileTest(base.BaseTestCase):
mock_remove.assert_called_with(config_file.dest)
@mock.patch('os.chmod')
- @mock.patch('os.chown')
- @mock.patch('pwd.getpwnam')
+ @mock.patch.object(set_configs, 'handle_permissions')
def test_set_permission(self,
- mock_getpwnam,
- mock_chown,
+ mock_handle_permissions,
mock_chmod):
- User = collections.namedtuple('User', ['pw_uid', 'pw_gid'])
- user = User(3333, 4444)
- mock_getpwnam.return_value = user
-
config_file = copy.deepcopy(FAKE_CONFIG_FILE)
config_file._set_permission(config_file.dest)
-
- mock_getpwnam.assert_called_with(config_file.owner)
- mock_chown.assert_called_with(config_file.dest, 3333, 4444)
- mock_chmod.assert_called_with(config_file.dest, 420)
+ mock_handle_permissions.assert_called_with({'owner': 'user1',
+ 'path': config_file.dest,
+ 'perm': '0644'})
@mock.patch('glob.glob', return_value=[])
def test_copy_no_source_not_optional(self,