[templates] Standardize toolbar across list and detail pages
This commit is contained in:
52
tests/scrobbles_tests/test_toolbar.py
Normal file
52
tests/scrobbles_tests/test_toolbar.py
Normal file
@ -0,0 +1,52 @@
|
||||
import pytest
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils import timezone
|
||||
from scrobbles.models import Scrobble
|
||||
from tasks.models import Task
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_standard_toolbar_on_base_list_page(client):
|
||||
user = get_user_model().objects.create_user(
|
||||
username="toolbaruser", password="testpass"
|
||||
)
|
||||
task = Task.objects.create(title="Ship the toolbar")
|
||||
Scrobble.objects.create(
|
||||
user=user,
|
||||
task=task,
|
||||
media_type="Task",
|
||||
timestamp=timezone.now(),
|
||||
)
|
||||
client.force_login(user)
|
||||
response = client.get(f"/tasks/{task.uuid}/")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
# Standard toolbar present on a base_list-based detail page
|
||||
assert "Search..." in content
|
||||
assert "Calendar" in content
|
||||
assert "Admin" in content
|
||||
assert "Charts" in content
|
||||
assert "Live" in content
|
||||
assert "Browse" in content
|
||||
assert "media-browser-menu" in content
|
||||
# Grid view toggle kept
|
||||
assert "Grid View" in content
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_standard_toolbar_on_home(client):
|
||||
user = get_user_model().objects.create_user(
|
||||
username="toolbarhome", password="testpass"
|
||||
)
|
||||
task = Task.objects.create(title="Task")
|
||||
Scrobble.objects.create(
|
||||
user=user, task=task, media_type="Task", timestamp=timezone.now()
|
||||
)
|
||||
client.force_login(user)
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode()
|
||||
assert "Search..." in content
|
||||
assert "Calendar" in content
|
||||
assert "Live" in content
|
||||
assert "media-browser-menu" in content
|
||||
Reference in New Issue
Block a user