def create_offerer( address: str = None, city: str = "Montreuil", date_created: datetime = datetime.utcnow(), date_modified_at_last_provider: datetime = None, idx: int = None, id_at_providers: str = None, is_active: bool = True, last_provider_id: int = None, name: str = "Test Offerer", postal_code: str = "93100", siren: Optional[str] = "123456789", thumb_count: int = 0, validation_token: str = None, ) -> Offerer: offerer = Offerer() offerer.address = address offerer.city = city offerer.dateCreated = date_created offerer.dateModifiedAtLastProvider = date_modified_at_last_provider offerer.id = idx offerer.idAtProviders = id_at_providers offerer.isActive = is_active offerer.lastProviderId = last_provider_id offerer.name = name offerer.postalCode = postal_code offerer.siren = siren offerer.thumbCount = thumb_count offerer.validationToken = validation_token return offerer
def _validate_offerer(offerer: Offerer, user_offerer: UserOfferer): offerer.validationToken = None user_offerer.validationToken = None repository.save(offerer, user_offerer)