from django.urls import resolve
from django.urls import reverse


def test_detail():
    """Test that user detail URL pattern works correctly."""
    # Arrange
    username = "testuser"

    # Act & Assert
    assert (
        reverse("users:detail", kwargs={"username": username})
        == f"/users/{username}/"
    )
    assert resolve(f"/users/{username}/").view_name == "users:detail"


def test_update():
    """Test that user update URL pattern works correctly."""
    # Act & Assert
    assert reverse("users:update") == "/users/~update/"
    assert resolve("/users/~update/").view_name == "users:update"


def test_redirect():
    """Test that user redirect URL pattern works correctly."""
    # Act & Assert
    assert reverse("users:redirect") == "/users/~redirect/"
    assert resolve("/users/~redirect/").view_name == "users:redirect"
