diff options
| author | Martin André <m.andre@redhat.com> | 2017-06-06 10:58:32 +0200 |
|---|---|---|
| committer | Martin André <m.andre@redhat.com> | 2017-06-21 18:17:44 +0200 |
| commit | 748a056b0964e2abf93ad66951957c834a32b81b (patch) | |
| tree | c2d14dbe7b2c96f2fe433cb443b918b3e7bcbce2 /tests/test_set_config.py | |
| parent | 091dc0306366d17ef793f05e1abfaf9ce95cc319 (diff) | |
| download | kolla-748a056b0964e2abf93ad66951957c834a32b81b.tar.gz kolla-748a056b0964e2abf93ad66951957c834a32b81b.zip | |
Allow setting copied files group more precisely
Previously with the config_files structure of config.json, the group
name was automatically set to the one of the user name. It is now
possible to set the group name in the same fashion than the
'permissions' structure with:
owner: 'desired_owner:desired_group'
Closes-Bug: #1696095
Change-Id: Ibae9f74e2351c81a717294467aedc51ea773c41e
Diffstat (limited to 'tests/test_set_config.py')
| -rw-r--r-- | tests/test_set_config.py | 18 |
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, |
