Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,130 @@ Common resources that a test might need,
like e.g. a running MSColab server or a QApplication instance for GUI tests,
are collected in :mod:`tests.fixtures` in the form of pytest fixtures that can be requested as needed in tests.

Testing Keyring Features
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can name it
Keyring Features

testing has some different meaning

========================
Comment thread
anj20 marked this conversation as resolved.
Outdated

This document provides step-by-step instructions for testing keyring features using both the command line and Python scripts.

Prerequisites
-------------

1. **Confirm the Default Keyring Backend**

Use the following command to list available keyring backends and check which one is currently in use:
::

keyring --list-backends

Command-Line Commands for Keyring
---------------------------------

1. **Set a Password**

Store a password for a specific service and user:
::

keyring set SERVICE_NAME USERNAME
Copy link
Copy Markdown
Member

@ReimarBauer ReimarBauer Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the examples maybe should destinguish the http_auth protection and a user password.
When you use the keyring set MSCOLAB_AUTH_{url} [email protected] then it needs a change to keyring set MSCOLAB_AUTH_{url} MSCOLAB_auth_user_name the default in the configuration is mscolab.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the WMS Servers this username can differ for each server, an example is given in config.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mscolab has besides the common http_auth also user accounts and they are not described here.

These can become tested when you add a user with a password to your local running server.

Copy link
Copy Markdown
Member

@ReimarBauer ReimarBauer Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an example here would be

keyring set http://localhost:8083 myname@mydomain

Then when you started mscolab and use the myname@mydomain for this url it fills in your saved credentials and you are logged in by login.


**Example:**
::

keyring set msui [email protected]

- The command will securely prompt you to input a password (e.g., `example_password`).

2. **Get a Password**

Retrieve the stored password for a service and user:
::

keyring get SERVICE_NAME USERNAME

**Example:**
::

keyring get msui [email protected]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is again mixed two cases. here you would do an example
keyring get http://localhost:8083 myname@mydomain

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and for the case of an http_auth

keyring get MSCOLAB_AUTH_http://localhost:8083 mscolab

**Output:**
::

example_password

3. **Delete a Password**

Remove the stored password for a service and user:
::

keyring delete SERVICE_NAME USERNAME

**Example:**
::

keyring delete msui [email protected]

To confirm the deletion, attempt to retrieve the password:
::

keyring get msui [email protected]

If the password has been deleted, you’ll see an error message such as:
::

No password found for 'msui' and '[email protected]'.

Python Script for Keyring Automation
------------------------------------

1. **Set a Password**

Store a password for a specific service and user:
::

import keyring

keyring.set_password("msui", "[email protected]", "example_password")

2. **Retrieve the Password**

Retrieve the stored password:
::

import keyring

print(keyring.get_password("msui", "[email protected]")) # Output: example_password

3. **Delete a Password**

Delete the stored password:
::

import keyring

keyring.delete_password("msui", "[email protected]")

4. **Verify Deletion**

Attempt to retrieve the deleted password:
::

import keyring

print(keyring.get_password("msui", "[email protected]")) # Output: None or error

Examples of Usage in Command Line
---------------------------------

::

# Set a password
keyring set my_service my_user

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixed again

we should have in the docs something a developer can use for the application.

This is also usefull when you have a new computer and want to transfer account data.

# Get the password
keyring get my_service my_user

# Delete the password
keyring delete my_service my_user

Changing the database model
---------------------------

Expand Down