def setUp(self): self.test_cert = Certificate() self.test_cert.id_exam_protocol = "cert" self.test_cert.date_certificate = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) self.test_cert.exam_complete_date = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) self.test_cert.date_certificate_mju = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) self.test_cert.info_quality = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) self.test_cert.save()
def setUp(self): self.certificate = Certificate() self.certificate.exam_complete_date = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) self.certificate.date_certificate_mju = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.date_certificate = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.info_quality = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.save() self.duplicate = DuplicateCertificate() self.duplicate.issue_date = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.duplicate.certificate = self.certificate self.duplicate.save()
def setUp(self): self.certificate = Certificate() self.certificate.exam_complete_date = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) self.certificate.date_certificate_mju = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.date_certificate = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.info_quality = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.save() self.department = Department() self.department.location = get_random_string(allowed_chars="dprmt") self.department.save() self.user = User(username="******") self.user.save() self.arbitre = Arbitration() self.arbitre.dismissal_date = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.arbitre.certificate = self.certificate self.arbitre.dep = self.department self.arbitre.user = self.user self.arbitre.save() self.DisciplinalPenalty = DisciplinalPenalty() self.DisciplinalPenalty.issue_date = rand_gen.randomDate( "2010-1-1", "2011-1-1", random.random()) self.DisciplinalPenalty.Arbitration = self.arbitre self.DisciplinalPenalty.protocol_number = get_random_string( allowed_chars="prtclnbr") self.DisciplinalPenalty.save()
def test_act_user_arbitration_response(self): request = RequestFactory().get('/login/') request.user = User.objects.create_user(username="******", password="******") jack = User.objects.create_user(username="******", password="******") person = Person() person.name = get_random_string(allowed_chars="prsn ") person.ownership_part = random.random() person.goverment_part = 100 - person.ownership_part person.save() judge = Jud() judge.name = get_random_string(allowed_chars="jdg ") judge.save() certificate = Certificate() certificate.exam_complete_date = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) certificate.date_certificate_mju = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) certificate.date_certificate = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) certificate.info_quality = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) certificate.save() department = Department() department.user = jack department.location = get_random_string(allowed_chars="dprmt") department.save() arbitre = Arbitration() arbitre.dismissal_date = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) arbitre.user = request.user arbitre.certificate = certificate arbitre.dep = department arbitre.save() act1 = Act() act1.start_date = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) act1.arbitr_start = act1.start_date act1.end_date = rand_gen.randomDate("2010-1-1", "2011-1-1", random.random()) act1.finish_jud_date = act1.end_date act1.arbitration = arbitre act1.jud = judge act1.person = person act1.save() self.assertEqual(act(request, act1.pk).status_code, 200)
def setUp(self): self.person = Person() self.person.name = get_random_string(allowed_chars="prsn ") self.person.ownership_part = random.random() self.person.goverment_part = 100 - self.person.ownership_part self.person.save() self.judge = Jud() self.judge.name = get_random_string(allowed_chars="jdg ") self.judge.save() self.certificate = Certificate() self.certificate.exam_complete_date = rand_gen.randomDate( "2008-1-1", "2009-1-1", random.random()) self.certificate.date_certificate_mju = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.date_certificate = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.info_quality = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.certificate.save() self.department = Department() self.department.location = get_random_string(allowed_chars="dprmt") self.department.save() self.user = User(username="******") self.user.save() self.arbitre = Arbitration() self.arbitre.dismissal_date = rand_gen.randomDate( "2009-1-1", "2010-1-1", random.random()) self.arbitre.certificate = self.certificate self.arbitre.dep = self.department self.arbitre.user = self.user self.arbitre.save() self.act = Act() self.act.start_date = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) self.act.arbitr_start = self.act.start_date self.act.end_date = rand_gen.randomDate("2010-1-1", "2011-1-1", random.random()) self.act.finish_jud_date = self.act.end_date self.act.arbitration = self.arbitre self.act.jud = self.judge self.act.person = self.person self.act.save()
def test_act_user_arbitration_response(self): request = RequestFactory().get('/login/') request.user = User.objects.create_user(username="******", password="******") jack = User.objects.create_user(username="******", password="******") person = Person() person.name = get_random_string(allowed_chars="prsn ") person.ownership_part = random.random() person.goverment_part = 100 - person.ownership_part person.save() judge = Jud() judge.name = get_random_string(allowed_chars="jdg ") judge.save() certificate = Certificate() certificate.exam_complete_date = rand_gen.randomDate("2008-1-1", "2009-1-1", random.random()) certificate.date_certificate_mju = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) certificate.date_certificate = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) certificate.info_quality = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) certificate.save() department = Department() department.user = jack department.location = get_random_string(allowed_chars="dprmt") department.save() arbitre = Arbitration() arbitre.dismissal_date = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) arbitre.user = request.user arbitre.certificate = certificate arbitre.dep = department arbitre.save() act1 = Act() act1.start_date = rand_gen.randomDate("2009-1-1", "2010-1-1", random.random()) act1.end_date = rand_gen.randomDate("2010-1-1", "2011-1-1", random.random()) act1.finish_jud_date = act1.end_date act1.arbitration = arbitre act1.jud_id_judge = judge act1.person = person act1.save() self.assertEqual(act(request, act1.pk).status_code, 200)