Skip to content
Snippets Groups Projects
Select Git revision
  • 4c7c6e1be04e107de2832fa007e90c1013f97bc3
  • master default protected
2 results

test_formsemestre.py

Blame
  • Forked from Jean-Marie Place / SCODOC_R6A06
    2143 commits behind the upstream repository.
    user avatar
    Emmanuel Viennet authored
    4c7c6e1b
    History
    test_formsemestre.py 1.28 KiB
    # -*- mode: python -*-
    # -*- coding: utf-8 -*-
    
    """ Test création/accès/clonage formsemestre
    """
    import pytest
    from tests.unit import yaml_setup
    
    import app
    from app.models import Formation
    from app.scodoc import sco_formsemestre_edit
    from config import TestConfig
    
    DEPT = TestConfig.DEPT_TEST
    
    
    def test_formsemestres_associate_new_version(test_client):
        """Test association à une nouvelle version du programme"""
        app.set_sco_dept(DEPT)
        # Construit la base de test GB une seule fois
        # puis lance les tests de jury
        yaml_setup.setup_from_yaml("tests/ressources/yaml/simple_formsemestres.yaml")
        formation = Formation.query.filter_by(acronyme="BUT GEII", version=1).first()
        formsemestres = formation.formsemestres.all()
        # On a deux S1:
        assert len(formsemestres) == 2
        assert {s.semestre_id for s in formsemestres} == {1}
        # Les rattache à une nouvelle version de la formation:
        formsemestre_ids = [s.id for s in formsemestres]
        sco_formsemestre_edit.do_formsemestres_associate_new_version(formsemestre_ids)
        new_formation: Formation = Formation.query.filter_by(
            acronyme="BUT GEII", version=2
        ).first()
        assert new_formation
        assert formsemestres[0].formation_id == new_formation.id
        assert formsemestres[1].formation_id == new_formation.id