Skip to content

Commit

Permalink
refactor: rename account settings tag
Browse files Browse the repository at this point in the history
  • Loading branch information
danjac committed Dec 29, 2024
1 parent d98e4bd commit c22d6f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion radiofeed/users/templatetags/account_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Item(TypedDict):


@register.simple_tag(takes_context=True)
def get_settings(context: RequestContext, current: str) -> dict:
def get_account_settings(context: RequestContext, current: str) -> dict:
""" "Returns a dictionary of settings items."""
items = {
"preferences": Item(
Expand Down
12 changes: 6 additions & 6 deletions radiofeed/users/tests/test_templatetags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from django.template.context import RequestContext

from radiofeed.users.templatetags.account_settings import get_settings
from radiofeed.users.templatetags.account_settings import get_account_settings


class MockGoogleAdapter:
Expand All @@ -14,17 +14,17 @@ def list_providers(self, request):
return []


class TestGetSettings:
class TestGetAccountSettings:
@pytest.mark.django_db
def test_get_settings(self, rf, mocker, user):
def test_get_account_settings(self, rf, mocker, user):
mocker.patch(
"radiofeed.users.templatetags.account_settings.get_adapter",
return_value=MockEmptyAdapter(),
)

req = rf.get("/")
req.user = user
context = get_settings(RequestContext(req), "preferences")
context = get_account_settings(RequestContext(req), "preferences")
assert context["current_item"]["label"] == "Preferences"
assert len(context["items"]) == 5

Expand All @@ -36,7 +36,7 @@ def test_connections(self, rf, mocker, user):
)
req = rf.get("/")
req.user = user
context = get_settings(RequestContext(req), "social_logins")
context = get_account_settings(RequestContext(req), "social_logins")
assert context["current_item"]["label"] == "Social Logins"
assert len(context["items"]) == 6

Expand All @@ -45,4 +45,4 @@ def test_invalid_item(self, rf, user):
req = rf.get("/")
req.user = user
with pytest.raises(KeyError):
get_settings(RequestContext(req), "not_found")
get_account_settings(RequestContext(req), "not_found")
2 changes: 1 addition & 1 deletion templates/components/account/settings.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load account_settings heroicons %}
<c-vars current />
{% get_settings current as settings %}
{% get_account_settings current as settings %}
<c-header>
<c-header.title> Settings for {{ user.username }} </c-header.title>
<c-header.nav>
Expand Down

0 comments on commit c22d6f8

Please sign in to comment.