Exemplo n.º 1
0
    def test_update_view_brand(self):
        """
        Tests data: Update
        """
        self.assertEqual(Studio.objects.all().count(), 0)
        studio = Studio()
        studio.name = 'studio test'
        studio.save()

        request = self.request_factory.get(reverse('studio_edit',
                                                   kwargs={'pk': studio.id})
        )
        request.user = self.user
        view = StudioUpdateView.as_view()
        response = view(request, pk=studio.id)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(Studio.objects.all().count(), 1)
        self.assertEqual(studio.name, 'studio test')
        #Post
        data = {
            'pk':  studio.id,
            'name': "actualizado",
        }

        url_kwargs = {'pk': studio.id}
        url = reverse('client_edit', kwargs=url_kwargs)
        request = self.request_factory.post(url, data=data)
        request.user = self.user
        view = StudioUpdateView.as_view()
        response = view(request, **data)

        client = Studio.objects.get(pk=1)
        self.assertEqual(client.name, 'actualizado')
        self.assertEqual(response.status_code, 302)
Exemplo n.º 2
0
# -*- coding: utf-8 -*-

from django.conf.urls import url, patterns
from apps.sp.views.panel.Studio import StudioListView, StudioCreateView, \
    StudioUpdateView, StudioDeleteView


urlpatterns = patterns('',
                       #Studio
                       url(r'^list/$',
                           StudioListView.as_view(),
                           name='studio_list'),
                       url(r'^create/$',
                           StudioCreateView.as_view(),
                           name='studio_create'),
                       url(r'^edit/(?P<pk>\d+)/$',
                           StudioUpdateView.as_view(),
                           name='studio_edit'),
                       url(r'^delete/(?P<pk>\d+)/$',
                           StudioDeleteView.as_view(),
                           name='studio_delete')
                       )
Exemplo n.º 3
0
# -*- coding: utf-8 -*-

from django.conf.urls import url, patterns
from apps.sp.views.panel.Studio import StudioListView, StudioCreateView, \
    StudioUpdateView, StudioDeleteView

urlpatterns = patterns(
    '',
    #Studio
    url(r'^list/$', StudioListView.as_view(), name='studio_list'),
    url(r'^create/$', StudioCreateView.as_view(), name='studio_create'),
    url(r'^edit/(?P<pk>\d+)/$', StudioUpdateView.as_view(),
        name='studio_edit'),
    url(r'^delete/(?P<pk>\d+)/$',
        StudioDeleteView.as_view(),
        name='studio_delete'))