Add downsample series functionality and related UI updates
- Implemented asynchronous downsample task for series with progress tracking. - Added new URL endpoint for downsample status. - Updated Series model to include source_series_instance_uid. - Enhanced case display template with new buttons for series actions. - Added password reset functionality in user profile with appropriate alerts. - Created migration for new source_series_instance_uid field in Series model.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
from django.urls import reverse
|
||||
from django.core import mail
|
||||
|
||||
from rich.pretty import pprint
|
||||
|
||||
@@ -89,3 +90,53 @@ def test_profile_access_and_management(db, client, create_users, create_cid_mana
|
||||
assert BeautifulSoup(update_profile_response.content, "html.parser").find(id="id_registration_number")["value"]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_user_reuses_existing_account(client, create_cid_manager, django_user_model):
|
||||
existing_user = django_user_model.objects.create_user(
|
||||
username="existing@example.com",
|
||||
email="existing@example.com",
|
||||
password="password123",
|
||||
first_name="Old",
|
||||
last_name="Name",
|
||||
)
|
||||
|
||||
client.force_login(create_cid_manager)
|
||||
|
||||
response = client.post(
|
||||
reverse("create_user"),
|
||||
{
|
||||
"username": "existing@example.com",
|
||||
"first_name": "Updated",
|
||||
"last_name": "User",
|
||||
"grade": "",
|
||||
},
|
||||
)
|
||||
|
||||
assert response.status_code == 302
|
||||
assert response.url == reverse("accounts_list")
|
||||
|
||||
existing_user.refresh_from_db()
|
||||
assert existing_user.first_name == "Updated"
|
||||
assert existing_user.last_name == "User"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_cid_manager_can_send_password_reset_from_account_profile(client, create_cid_manager, django_user_model):
|
||||
managed_user = django_user_model.objects.create_user(
|
||||
username="managed-user",
|
||||
email="managed@example.com",
|
||||
password="password123",
|
||||
)
|
||||
|
||||
client.force_login(create_cid_manager)
|
||||
response = client.post(
|
||||
reverse("account_send_password_reset", kwargs={"slug": managed_user.username}),
|
||||
{"next": reverse("account_profile", kwargs={"slug": managed_user.username})},
|
||||
)
|
||||
|
||||
assert response.status_code == 302
|
||||
assert "password_reset_action=sent" in response.url
|
||||
assert len(mail.outbox) == 1
|
||||
assert mail.outbox[0].to == ["managed@example.com"]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user