mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-10 08:34:59 +08:00
Set anonymous owner when NO_AUTH
This commit is contained in:
@@ -85,7 +85,7 @@ def get_user(request):
|
||||
|
||||
if app.config['NO_AUTH']:
|
||||
log.debug("Authorization is disabled.")
|
||||
return
|
||||
return "anonymous", {"packager"}
|
||||
|
||||
_load_secrets()
|
||||
|
||||
|
||||
@@ -104,7 +104,9 @@ class TestAuthModule(unittest.TestCase):
|
||||
def test_disable_authentication(self):
|
||||
with patch.dict('module_build_service.app.config', {'NO_AUTH': True}, clear=True):
|
||||
request = mock.MagicMock()
|
||||
eq_(module_build_service.auth.get_user(request), None)
|
||||
username, groups = module_build_service.auth.get_user(request)
|
||||
eq_(username, "anonymous")
|
||||
eq_(groups, {"packager"})
|
||||
|
||||
@patch('module_build_service.auth.client_secrets', None)
|
||||
def test_misconfiguring_oidc_client_secrets_should_be_failed(self):
|
||||
|
||||
Reference in New Issue
Block a user