Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simpler way to pre-compute passwords for Django #366

Closed
4 tasks done
rbarrois opened this issue Apr 7, 2017 · 0 comments · Fixed by #623
Closed
4 tasks done

Add a simpler way to pre-compute passwords for Django #366

rbarrois opened this issue Apr 7, 2017 · 0 comments · Fixed by #623

Comments

@rbarrois
Copy link
Member

rbarrois commented Apr 7, 2017

Currently, the documented method is to use factory.PostGenerationMethodCall('set_password', 'example').

This version has two drawbacks:

  • Each such object is saved twice to the database (once for creation, and once after the password has been set)
  • Overriding the chosen password has a weird API

We should instead provide a factory.django.Password() helper, which would basically wrap Django's make_password function.

Checklist:

  • Create a new "Password" declaration, inspired from the existing FileField one
  • Add some tests in the tests/test_django module
  • Document it in the Django section
  • Find another example for PostGenerationMethodCall (otherwise users may not use the new path)
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
User passwords don’t depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
User passwords don’t depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
User passwords don’t depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
User passwords don’t depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 15, 2019
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jun 16, 2019
User passwords don’t depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jul 13, 2019
User passwords don’t depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Nov 28, 2019
User passwords do not depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Nov 28, 2019
User passwords do not depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Nov 14, 2020
User passwords do not depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
@francoisfreitag francoisfreitag added this to the 4.0 milestone Nov 14, 2020
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Nov 14, 2020
User passwords do not depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Nov 14, 2020
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Nov 22, 2020
User passwords do not depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs FactoryBoy#366

Reviewed-by: Jon Dufresne
francoisfreitag added a commit that referenced this issue Nov 22, 2020
User passwords do not depend on the generated object. The previous
example was tied to Django behavior, while `factory_boy` is a general
purpose library. Besides, this example gets in the way of removing the
duplicate call to `.save()` after `postgeneration` hooks.

Refs #366

Reviewed-by: Jon Dufresne
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Nov 22, 2020
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Dec 4, 2020
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Feb 12, 2021
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes FactoryBoy#316
Fixes FactoryBoy#366
francoisfreitag added a commit that referenced this issue Feb 12, 2021
Transforms a value using provided `transform` function. Values coming
from the declaration and values overridden through keywords arguments
are transformed before the generated object attribute is set.

Removes the need to save objects with a post generation hook twice to
the database.

Facilitates overriding Django passwords when instantiating the factory.

Fixes #316
Fixes #366
@francoisfreitag francoisfreitag modified the milestones: 4.0, 3.3.0 Feb 18, 2021
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Feb 18, 2021
Helps keeping track of what should be removed in release 4.0.

Refs FactoryBoy#316
Refs FactoryBoy#366
francoisfreitag added a commit to francoisfreitag/factory_boy that referenced this issue Jul 2, 2021
Helps keeping track of what should be removed in release 4.0.

Reviewed-by: Jon Dufresne

Refs FactoryBoy#316
Refs FactoryBoy#366
francoisfreitag added a commit that referenced this issue Jul 2, 2021
Helps keeping track of what should be removed in release 4.0.

Reviewed-by: Jon Dufresne

Refs #316
Refs #366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants