-
Notifications
You must be signed in to change notification settings - Fork 25
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
Added validator, tries and default to str generator functions #87
Conversation
@omaciel I've tried to access coverals to check why coverage decrease but faced this msg: The owner of this repo needs to re-authorize with github; their OAuth credentials are no longer valid so the file cannot be pulled from the github API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Comments are not blockers.
|
||
class CheckValidationTestCase(unittest.TestCase): | ||
"""_check_validation decorator tests""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a real case test here:
Example is SatelliteQE/robottelo#4407 which generated string cannot start with number
And also https://github.com/SatelliteQE/robottelo/blob/master/robottelo/libvirt_discovery.py#L21 which gen_mac cannot start with fe:
(then once released we can update those codes to use validators)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add validation to gen_mac, going to do that
fauxfactory/__init__.py
Outdated
if validator is None: | ||
validator_fcn = lambda _: True | ||
else: | ||
validator_fcn=validator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace between operator
# Public Functions ------------------------------------------------------------ | ||
|
||
|
||
def gen_string(str_type, length=None): | ||
def gen_string(str_type, length=None, validator=None, default=None, tries=10): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this one cannot be decorated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once this function only delegates to already decorated functions, decorating it would only useless apply validation 2 times.
@omaciel can we merge this one? (and release) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
@rochacbruno merged and published on Pypi! @renzon it would be great to have the documentation updated to include some examples of how to use the new functionality :) |
close #86