Repository navigation
ref: deduplicate creation of DCOR-dev users - #115
Merged
Merged
Conversation
Creating a user on DCOR-dev was implemented both in the setup wizard (`get_dcor_dev_api_key`) and in the tests (`tests/common.py`). Move it to `dcoraid.api.users` (`create_dcor_dev_user`) together with an API key validity check (`is_valid_api_key`) and use these in both places. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paulmueller-agent
force-pushed
the
ref-dev-user
branch
from
October 22, 2026 09:48
0afbd18 to
41ef1a2
Compare
This was referenced Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creating a user on DCOR-dev was implemented twice: in the setup wizard (
gui/wizard_init.get_dcor_dev_api_key) and in the tests (tests/common.py, since #111). Both now use a new moduledcoraid/api/users.py.New functions (exported in
dcoraid.api)create_dcor_dev_user(server="dcor-dev.mpl.mpg.de", fullname=None, ssl_verify=True) -> struser_createwithwith_apitoken=Trueand returns the API token.dcoraid-xxxxx,…@dcor-dev.mpl.mpg.de), so the weekly purge keeps working.is_valid_api_key(server, api_key, ssl_verify=True) -> boolFalsefor empty keys without contacting the server, and forAPIAuthorizationError,APINotFoundErrorandNoAPIKeyError.Users
get_dcor_dev_api_key()in the setup wizard shrinks to three lines.tests/common.pydrops its ownis_valid_api_keyandcreate_test_user.The one behaviour difference: users created by the wizard get a full UUID as password instead of its first 8 characters. The password is never shown or used; the API token is what DCOR-Aid uses.
Tests
tests/test_api_users.py:CKANAPIfor theuser_createpayload, the default and custom full name, and invalid or empty keysis_valid_api_keywith a valid and a revoked-looking key. It doesn't create a user on every run.tests/api_keyandtests/api_key_2removed, the test session creates both users through the new function.test_api_users.py,test_dbmodel_api.pyandtest_dbmodel_api_cache.pypass (31 tests).get_dcor_dev_api_key()with empty settings creates a valid user ("Player 3ffb3").🤖 Generated with Claude Code