You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
2.0 KiB
50 lines
2.0 KiB
from django.urls import reverse
|
|
from rest_framework.test import APITestCase
|
|
|
|
|
|
class PodcastURLResolutionTests(APITestCase):
|
|
"""
|
|
Test suite to ensure all podcast API endpoints resolve and execute cleanly.
|
|
"""
|
|
|
|
def test_category_list_endpoint(self):
|
|
"""Test podcast categories endpoint is accessible"""
|
|
url = reverse('podcast:category-list')
|
|
response = self.client.get(url)
|
|
self.assertLess(response.status_code, 500)
|
|
|
|
def test_pinned_collection_list_endpoint(self):
|
|
"""Test podcast pinned collections endpoint is accessible"""
|
|
url = reverse('podcast:pinned-collection-list')
|
|
response = self.client.get(url)
|
|
self.assertLess(response.status_code, 500)
|
|
|
|
def test_collection_list_endpoint(self):
|
|
"""Test podcast collections endpoint is accessible"""
|
|
url = reverse('podcast:collection-list')
|
|
response = self.client.get(url)
|
|
self.assertLess(response.status_code, 500)
|
|
|
|
def test_podcast_list_endpoint(self):
|
|
"""Test podcast list endpoint is accessible"""
|
|
url = reverse('podcast:podcast-list')
|
|
response = self.client.get(url)
|
|
self.assertLess(response.status_code, 500)
|
|
|
|
def test_podcast_detail_endpoint(self):
|
|
"""Test podcast detail endpoint is accessible (may return 404 if no data)"""
|
|
url = reverse('podcast:podcast-detail', kwargs={'slug': 'test-podcast'})
|
|
response = self.client.get(url)
|
|
self.assertLess(response.status_code, 500)
|
|
|
|
def test_user_playlist_create_endpoint(self):
|
|
"""Test user playlist create endpoint is accessible (POST)"""
|
|
url = reverse('podcast:user-playlist-create')
|
|
response = self.client.post(url)
|
|
self.assertLess(response.status_code, 500)
|
|
|
|
def test_user_playlist_list_endpoint(self):
|
|
"""Test user playlist list endpoint is accessible"""
|
|
url = reverse('podcast:user-playlist-list')
|
|
response = self.client.get(url)
|
|
self.assertLess(response.status_code, 500)
|