示例#1
0
文件: tests.py 项目: brouberol/BS-BDD
    def test_create_domaine_admission(self):
        da = DomaineAdmission(nom='Parachutage')
        da.save()

        # da exists in DB ?
        self.assertNotEqual(da.id, 0)

        # can we retrieve da in DB ?
        da_id = da.id
        da = None
        da = DomaineAdmission.objects.get(nom='Parachutage')
        self.assertEqual(da.id, da_id)
示例#2
0
文件: tests.py 项目: brouberol/BS-BDD
    def test_create_domaine_admission(self):
        da = DomaineAdmission(nom='Parachutage')
        da.save()
        
        # da exists in DB ?
        self.assertNotEqual(da.id, 0)

        # can we retrieve da in DB ?
        da_id = da.id     
        da = None
        da = DomaineAdmission.objects.get(nom='Parachutage')
        self.assertEqual(da.id, da_id)
示例#3
0
def create_admission(row, etat_civil):
    """Read an excel row and save the corresponding Admission object in database"""
    errors = []
    ad = Admission()
    try:
        ad.filiere_org = FiliereAdmission.objects.get(
            nom=row['origine_avant_BS'])
    except FiliereAdmission.DoesNotExist:
        ad.filiere_org = FiliereAdmission(nom=row['origine_avant_BS'])
    try:
        ad.domaine_org = DomaineAdmission.objects.get(
            nom=row['filiere_avant_BS'])
    except DomaineAdmission.DoesNotExist:
        ad.domaine_org = DomaineAdmission(nom=row['filiere_avant_BS'])
    ad.annee_admission = row['annee_admission']
    ad.rang_pre_BS = row['classement_avant_BS']
    ad.taille_promo_pre_BS = row['taille_de_promo_avant_BS']
    try:
        ad.full_clean()
    except ValidationError, e:
        m = dict(e.message_dict)
        errors.append([
            str("%s %s" % (etat_civil.prenom, etat_civil.nom_insa)),
            [list(k) for k in zip(m.keys(), m.values())]
        ])
示例#4
0
文件: tests.py 项目: brouberol/BS-BDD
 def setUp(self):
     fa = FiliereAdmission(nom='Ecole Jedi')
     da = DomaineAdmission(nom='Parachutage')
     fa.save()
     da.save()
示例#5
0
文件: tests.py 项目: brouberol/BS-BDD
 def setUp(self):
     fa = FiliereAdmission(nom='Ecole Jedi')
     da = DomaineAdmission(nom='Parachutage')
     fa.save()
     da.save()