def get_casting(self, **kwargs): return Casting()
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)