Esempio n. 1
0
    def test_basic(self):
        """
        Test that the solo view return a 200 response, uses
        the correct template, and has the correct context
        """
        request = self.factory.get('/solos/1/')

        response = SoloDetailView.as_view()(request, pk=self.drum_solo.pk)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context_data['solo'].artist, 'Rich')
        with self.assertTemplateUsed('solos/solo_detail.html'):
            response.render()
Esempio n. 2
0
    def test_basic(self):
        """
        Test that the solo view returns a 200 response, uses the correct template,
         and has the correct context
        """
        request = self.factory.get('/solos/1/')

        response = SoloDetailView.as_view()(
            request,
            pk=self.drum_solo.pk
        )

        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context_data['solo'].artist, 'Rich')

        with self.assertTemplateUsed('solos/solo_detail.html'):
            response.render()
Esempio n. 3
0
"""jmad URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin

from solos.views import SoloDetailView

urlpatterns = [
    url(r'^$', 'solos.views.index'),
    url(r'^recordings/(?P<album>[\w-]+)/(?P<track>[\w-]+)/(?P<artist>[\w-]+)/$', SoloDetailView.as_view(), name='solo_detail_view'),
    url(r'^admin/', include(admin.site.urls)),
]
Esempio n. 4
0
"""jmad URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin

from solos.views import SoloDetailView

urlpatterns = [
    url(r'^$', 'solos.views.index'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^solos/(?P<pk>\d+)/$', SoloDetailView.as_view()),
]
Esempio n. 5
0
from django.conf.urls import include, url
from django.contrib import admin

from solos.views import SoloDetailView

urlpatterns = [
    url(r'^solos/(?P<pk>\d+)/$', SoloDetailView.as_view()),
    url(r'^$', 'solos.views.index'),
    url(r'^admin/', include(admin.site.urls)),
]