Ejemplo n.º 1
0
    def test_channel_schedule_view(self):
        channel = Channel.objects.get(name="channel")

        request = self.factory.get('/schedule/')
        response = ChannelSchedule.as_view()(request, pk=str(channel.pk))

        self.assertEqual(response.status_code, 200)
Ejemplo n.º 2
0
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static

from core.views import IndexView
from streams.views import ChannelSchedule, ChannelDetailAPI,\
    ChannelContentListAPI, ChannelProgramListAPI, MountDetailAPI,\
    ChannelStatusAPI, MountMetadataAPI
from programs.views import ProgramDetailAPI, ProgramContentListAPI
from sources.views import RecordingDetailAPI

urlpatterns = [
    # Site
    url(r'^$', IndexView.as_view()),
    url(r'^schedule/(?P<pk>[0-9]+)/$',
        ChannelSchedule.as_view()),
    url(r'^admin/', admin.site.urls),

    # API
    url(r'^api/channel/detail/(?P<pk>[0-9]+)/$',
        ChannelDetailAPI.as_view()),
    url(r'^api/channel/content/(?P<pk>[0-9]+)/$',
        ChannelContentListAPI.as_view()),
    url(r'^api/channel/programs/(?P<pk>[0-9]+)/$',
        ChannelProgramListAPI.as_view()),
    url(r'^api/channel/now/(?P<pk>[0-9]+)/$',
        ChannelStatusAPI.as_view()),

    url(r'^api/mount/detail/(?P<pk>[0-9]+)/$',
        MountDetailAPI.as_view()),
    url(r'^api/mount/metadata/(?P<pk>[0-9]+)/$',
Ejemplo n.º 3
0
 def test_channel_schedule_view_not_exists(self):
     with self.assertRaises(Http404):
         request = self.factory.get('/schedule/')
         ChannelSchedule.as_view()(request, pk="300000")