def test_own_manages_ownership(self, own_app_mock): """ tests that own manages ownership and writes to log. """ app_home_nested_file = os.path.join(self.app_home, 'app_name', 'file') os.makedirs(os.path.join(self.app_home, 'app_name')) with open(app_home_nested_file, 'w') as file: file.write('some text') user = '******' group = 'app_user' runlog = CommandFileUtils(self.dist_version, self.log_file, self.log_level) runlog.own(self.app_home, user, group) self.assertEqual([call(self.app_home, user, group)], own_app_mock.mock_calls, own_app_mock.mock_calls) self.log('INFO: changed ownership of %s to %s:%s' % (self.app_home, user, user))