diora-web/radio/tests.py
mrwnslz c522b22cd9
All checks were successful
Build and push Docker image / build (push) Successful in 16s
Test / test (push) Successful in 6m56s
Oberfläche eingedeutscht: Radio, Bücher/Reader, Fokus, Konto, Anmeldung; sw v71
- app.js, Templates, Stream-Fenster, Manifest: alle sichtbaren Texte deutsch
  (Eingabefenster "Abbrechen", Markierungs-Export, Lesezeichen, Reader-Einstellungen …)
- LANGUAGE_CODE 'de': Formular-, Passwort- und Validierungsmeldungen von Django deutsch
- Empfehlungen: "Was du unter der Woche abends oft hörst:"
- Fehlercodes der API bleiben englisch (Vertrag für Clients und Tests); was die
  Seite davon zeigt, übersetzt _germanError()

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:53:01 +02:00

40 lines
1.9 KiB
Python

from pathlib import Path
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
class PlayerPagePodcastsTests(TestCase):
"""The podcast tab is the app's podcast page (static/podcasts/, copied from
diora-android) on a browser host (static/js/podcasts-web.js)."""
def test_logged_in_page_loads_the_podcast_host(self):
user = User.objects.create_user('pod', password='pw-for-tests-only')
self.client.force_login(user)
html = self.client.get('/').content.decode()
self.assertIn('id="tab-podcasts"', html)
self.assertIn('<script src="/static/js/podcasts-web.js"></script>', html)
self.assertIn('dpw-loading', html)
# The old podcast tab and its player bar are gone.
self.assertNotIn('podcast-toolbar', html)
self.assertNotIn('podcast-seek-bar', html)
self.assertNotIn('INITIAL_PODCAST_FEEDS', html)
def test_logged_out_page_asks_to_log_in(self):
html = self.client.get('/').content.decode()
self.assertIn('um Podcasts zu abonnieren.', html)
self.assertNotIn('dpw-loading', html)
def test_podcast_ui_files_are_there(self):
static = Path(settings.BASE_DIR) / 'static'
host = (static / 'js' / 'podcasts-web.js').read_text(encoding='utf-8')
for name in ('native-podcast.js', 'podcast-ui.css', 'podcasts-web.css'):
path = static / 'podcasts' / name
self.assertTrue(path.exists(), name)
if name != 'podcasts-web.css':
self.assertIn('Copied from diora-android', path.read_text(encoding='utf-8')[:300])
self.assertIn('/static/podcasts/' + name, host)
sw = (static / 'js' / 'sw.js').read_text(encoding='utf-8')
for path in ('/static/js/podcasts-web.js', '/static/podcasts/native-podcast.js'):
self.assertIn(path, sw)