File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
api/src/pcapi/core/educational Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class EducationalInstitutionFactory(BaseFactory[models.EducationalInstitution]):
4141 class Meta :
4242 model = models .EducationalInstitution
4343
44- institutionId = factory .Sequence (lambda x : f" { x + 1 } 470009E" )
44+ institutionId = factory .Sequence (lambda x : _get_institution_id ( x ) )
4545 name = factory .Sequence ("DE LA TOUR{}" .format )
4646 city = "PARIS"
4747 postalCode = "75000"
@@ -52,6 +52,13 @@ class Meta:
5252 longitude = 2.3522
5353
5454
55+ def _get_institution_id (sequence_number : int ) -> str :
56+ # institutionId (UAI) is a unique string with 7 digits and 1 letter
57+ # put sequence number at the end and left-fill with 0
58+ prefix = (7 - len (str (sequence_number ))) * "0"
59+ return f"{ prefix } { sequence_number } F"
60+
61+
5562class CollectiveOfferFactory (BaseFactory [models .CollectiveOffer ]):
5663 class Meta :
5764 model = models .CollectiveOffer
You can’t perform that action at this time.
0 commit comments