2023-12-27 14:31:50 +00:00
|
|
|
from selfprivacy_api.utils import ReadUserData, WriteUserData
|
|
|
|
from selfprivacy_api.actions.users import delete_user
|
2024-01-09 18:58:09 +00:00
|
|
|
|
2023-12-27 14:31:50 +00:00
|
|
|
"""
|
|
|
|
A place for user storage tests and other user tests that are not Graphql-specific.
|
|
|
|
"""
|
|
|
|
|
2024-01-09 18:58:09 +00:00
|
|
|
# yes it is an incomplete suite.
|
|
|
|
# It was born in order to not lose things that REST API tests checked for
|
2023-12-27 14:31:50 +00:00
|
|
|
# In the future, user storage tests that are not dependent on actual API (graphql or otherwise) go here.
|
|
|
|
|
2024-01-09 18:58:09 +00:00
|
|
|
|
2023-12-27 14:31:50 +00:00
|
|
|
def test_delete_user_writes_json(generic_userdata):
|
|
|
|
delete_user("user2")
|
|
|
|
with ReadUserData() as data:
|
|
|
|
assert data["users"] == [
|
2024-01-09 18:58:09 +00:00
|
|
|
{
|
|
|
|
"username": "user1",
|
|
|
|
"hashedPassword": "HASHED_PASSWORD_1",
|
|
|
|
"sshKeys": ["ssh-rsa KEY user1@pc"],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"username": "user3",
|
|
|
|
"hashedPassword": "HASHED_PASSWORD_3",
|
|
|
|
"sshKeys": ["ssh-rsa KEY user3@pc"],
|
|
|
|
},
|
|
|
|
]
|