Esempio n. 1
0
    def test_update_project(self):
        self.assertEqual(Project.objects.all().count(), 4)
        url = reverse('project_update')
        project = self.insert_project()
        casting = Casting()
        casting.project = project
        casting.save()
        self.assertEqual(Project.objects.all().count(), 5)

        commercial = Commercial.objects.get(pk=1)
        client_director = Client.objects.get(pk=3)
        client_agency = Client.objects.get(pk=2)
        client_productor = Client.objects.get(pk=1)

        data = {
            'duty': {},
            'models': [{
                'profile':
                'perfil',
                'scene':
                '1',
                'character': {
                    'id': 1,
                    'name': 'Principal'
                },
                'feature':
                'carracteristicas',
                'budget':
                '100',
                'cant':
                2,
                'type': [{
                    'id': 1,
                    'name': 'Especifico'
                }, {
                    'id': 2,
                    'name': 'Archivo'
                }]
            }, {
                'profile': 'perfil test',
                'scene': '1',
                'character': {
                    'id': 0,
                    'name': 'Secundario'
                },
                'feature': 'features',
                'budget': '200',
                'cant': 3,
                'type': [{
                    'id': 2,
                    'name': 'Archivo'
                }]
            }],
            'commercial': {
                'dates': [{
                    'date': '15/08/2014'
                }, {
                    'date': '06/08/2014'
                }],
                'name': 'new commercial',
                'id': commercial.id
            },
            'deliveries': [{
                'date': '01/08/2014'
            }, {
                'date': '02/08/2014'
            }, {
                'date': '12/08/2014'
            }],
            'project': {
                'end_productions': '07/08/2014',
                'budget_cost': '800',
                'line_productions': 1,
                'commercial': commercial.id,
                'budget': '1000',
                'currency': 2,
                'observations': 'Mis observaciones',
                'start_productions': '01/08/2014'
            },
            'client': {
                'director': client_director.id,
                'agency': client_agency.id,
                'productor': client_productor.id
            },
            'line': {},
            'project_id':
            project.id,
            'payment': {
                'client': client_director.id,
                'conditions': ['condicion1', 'condicion2']
            },
            'resources': []
        }

        view = ProjectUpdateJsonView.as_view()
        request = self.request_factory.post(url,
                                            data=dumps(data),
                                            content_type='application/json')
        request.user = self.user
        response = view(request)
        content = json.loads(response._container[0])
        self.assertEqual(content.get('status'), 'success')
        self.assertEqual(Project.objects.all().count(), 5)
Esempio n. 2
0
    url(r'^$', ProjectListView.as_view(), name='project_list'),
    url(r'^update-finish/(?P<pk>\d+)/$',
        ProjectFinishRedirectView.as_view(),
        name='project_change_finish'),
    url(r'^update-start/(?P<pk>\d+)/$',
        ProjectStartRedirectView.as_view(),
        name='project_change_start'),
    url(r'^delete/(?P<pk>\d+)/$',
        ProjectDeleteRedirectView.as_view(),
        name='project_delete'),
    url(r'^create/(?P<pk>[^/]+)/$',
        ProjectCreateView.as_view(),
        name='project_crud'),
    url(r'^roles/$', ProjectRolesJsonView.as_view(),
        name='project_roles_json'),
    url(r'^save/$', ProjectSaveJsonView.as_view(), name='project_save'),
    url(r'^update/$', ProjectUpdateJsonView.as_view(), name='project_update'),
    url(r'^data-update/(?P<pk>[^/]+)/$',
        ProjectDataUpdateJsonView.as_view(),
        name='project_update_data_json'),
    url(r'^line-json/$',
        ProjectLinesJsonView.as_view(),
        name='project_line_json'),
    url(r'^detail-model-json/(?P<pk>[^/]+)/$',
        DetailModelJsonView.as_view(),
        name='detail_model_json'),
    url(r'^pauta-detail-json/(?P<pk>[^/]+)/$',
        PautaDetailModelJsonView.as_view(),
        name='pauta_detail_model_json'),
)
Esempio n. 3
0
from apps.sp.views.panel.Project import (
    ProjectListView,
    ProjectCreateView,
    ProjectRolesJsonView,
    ProjectSaveJsonView,
    ProjectLinesJsonView,
    ProjectUpdateJsonView,
    ProjectDataUpdateJsonView,
    DetailModelJsonView,
    ProjectFinishRedirectView,
    ProjectStartRedirectView,
    ProjectDeleteRedirectView,
    PautaDetailModelJsonView,
)

urlpatterns = patterns(
    "",
    url(r"^$", ProjectListView.as_view(), name="project_list"),
    url(r"^update-finish/(?P<pk>\d+)/$", ProjectFinishRedirectView.as_view(), name="project_change_finish"),
    url(r"^update-start/(?P<pk>\d+)/$", ProjectStartRedirectView.as_view(), name="project_change_start"),
    url(r"^delete/(?P<pk>\d+)/$", ProjectDeleteRedirectView.as_view(), name="project_delete"),
    url(r"^create/(?P<pk>[^/]+)/$", ProjectCreateView.as_view(), name="project_crud"),
    url(r"^roles/$", ProjectRolesJsonView.as_view(), name="project_roles_json"),
    url(r"^save/$", ProjectSaveJsonView.as_view(), name="project_save"),
    url(r"^update/$", ProjectUpdateJsonView.as_view(), name="project_update"),
    url(r"^data-update/(?P<pk>[^/]+)/$", ProjectDataUpdateJsonView.as_view(), name="project_update_data_json"),
    url(r"^line-json/$", ProjectLinesJsonView.as_view(), name="project_line_json"),
    url(r"^detail-model-json/(?P<pk>[^/]+)/$", DetailModelJsonView.as_view(), name="detail_model_json"),
    url(r"^pauta-detail-json/(?P<pk>[^/]+)/$", PautaDetailModelJsonView.as_view(), name="pauta_detail_model_json"),
)
Esempio n. 4
0
    def test_update_project(self):
        self.assertEqual(Project.objects.all().count(), 4)
        url = reverse('project_update')
        project = self.insert_project()
        casting = Casting()
        casting.project = project
        casting.save()
        self.assertEqual(Project.objects.all().count(), 5)

        commercial = Commercial.objects.get(pk=1)
        client_director = Client.objects.get(pk=3)
        client_agency = Client.objects.get(pk=2)
        client_productor = Client.objects.get(pk=1)

        data = {
            'duty': {},
            'models': [
                {
                    'profile': 'perfil',
                    'scene': '1',
                    'character': {'id': 1, 'name': 'Principal'},
                    'feature': 'carracteristicas',
                    'budget': '100',
                    'cant': 2,
                    'type': [
                        {'id': 1, 'name': 'Especifico'},
                        {'id': 2, 'name': 'Archivo'}
                    ]
                },
                {
                    'profile': 'perfil test',
                    'scene': '1',
                    'character': {'id': 0, 'name': 'Secundario'},
                    'feature': 'features',
                    'budget': '200',
                    'cant': 3,
                    'type': [
                        {'id': 2, 'name': 'Archivo'}
                    ]
                }
            ],
            'commercial': {
                'dates': [
                    {'date': '15/08/2014'},
                    {'date': '06/08/2014'}
                ], 'name': 'new commercial',
                'id': commercial.id
            },
            'deliveries': [
                {'date': '01/08/2014'},
                {'date': '02/08/2014'},
                {'date': '12/08/2014'}
            ],
            'project':
                {
                    'end_productions': '07/08/2014',
                    'budget_cost': '800',
                    'line_productions': 1,
                    'commercial': commercial.id,
                    'budget': '1000',
                    'currency': 2,
                    'observations':'Mis observaciones',
                    'start_productions': '01/08/2014'
                },
            'client': {
                'director': client_director.id,
                'agency': client_agency.id,
                'productor': client_productor.id
            },
            'line': {},
            'project_id': project.id,
            'payment':
                {
                    'client': client_director.id,
                    'conditions': ['condicion1', 'condicion2']
                },
            'resources': []
        }


        view = ProjectUpdateJsonView.as_view()
        request = self.request_factory.post(
            url, data=dumps(data), content_type='application/json'
        )
        request.user = self.user
        response = view(request)
        content = json.loads(response._container[0])
        self.assertEqual(content.get('status'), 'success')
        self.assertEqual(Project.objects.all().count(), 5)