Skip to content

Commit

Permalink
Merge pull request #663 from cylc/1.6.x-sync
Browse files Browse the repository at this point in the history
🤖 Merge 1.6.x-sync into master
  • Loading branch information
MetRonnie authored Jan 16, 2025
2 parents 8c94579 + cbbd6cb commit aeddbcb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ $ towncrier create <PR-number>.<break|feat|fix>.md --content "Short description"

<!-- towncrier release notes start -->

## cylc-uiserver-1.6.1 (Released 2025-01-15)

### 🚀 Enhancements

[#661](https://github.com/cylc/cylc-uiserver/pull/661) - The GUI can now be launched in standalone mode even if `[hub]url` is configured, using the `--new` option.

### 🔧 Fixes

[#660](https://github.com/cylc/cylc-uiserver/pull/660) - Fixed crash when starting the UI Server if a user has invalid groups in their profile.

## cylc-uiserver-1.6.0 (Released 2025-01-08)

[Updated cylc-ui to 2.7.0](https://github.com/cylc/cylc-ui/blob/master/CHANGES.md)
Expand Down
1 change: 0 additions & 1 deletion changes.d/661.feat.md

This file was deleted.

2 changes: 1 addition & 1 deletion cylc/uiserver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def set_auth(self) -> Authorization:
getpass.getuser(),
user_auth,
site_auth,
self.log,
log=self.log,
)

def initialize_templates(self):
Expand Down
6 changes: 3 additions & 3 deletions cylc/uiserver/authorise.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ def __init__(
log,
):
self.owner_user_name: str = owner_user_name
self.owner_user_groups: List[str] = self._get_groups(
self.owner_user_name
)
self.log = log
self.owner_auth_conf: dict = owner_auth_conf
self.site_auth_config: dict = site_auth_conf
self.owner_user_groups: List[str] = self._get_groups(
self.owner_user_name
)
self.owner_dict = self.build_owner_site_auth_conf()

# lru_cache this method - see flake8-bugbear B019
Expand Down
20 changes: 20 additions & 0 deletions cylc/uiserver/tests/test_authorise.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import inspect
import logging
from types import SimpleNamespace
from unittest.mock import Mock, patch
Expand Down Expand Up @@ -476,3 +477,22 @@ def test_empty_list_in_config():
auth_obj = Authorization('me', {}, {'*': {'me': {'default': []}}}, LOG)
with pytest.raises(Exception, match='Error in site config'):
auth_obj.return_site_auth_defaults_for_access_user('me', ['x'])


def test_Authorization_logging(monkeypatch: pytest.MonkeyPatch):
"""Test logging doesn't fall over spectacularly during __init__()."""
# Patch all methods to call self.log:
for name, method in inspect.getmembers(
Authorization, predicate=inspect.isfunction
):
if (
not name.startswith('__') and
inspect.signature(method).parameters.get('self')
):
monkeypatch.setattr(
Authorization,
name,
lambda self, *a, **k: self.log.info('foo'),
)
# Test:
Authorization('brian', {}, {}, log=Mock())

0 comments on commit aeddbcb

Please sign in to comment.