[WIP] Extend ab test capabilities#1
Open
nacosta wants to merge 12 commits into
Open
Conversation
added 12 commits
October 12, 2018 17:25
| class UserConditionSetTests(TestCase): | ||
| """ Regression tests (before adding AB_TEST) """ | ||
|
|
||
| def _create_contition(self, name, condition): |
| if condition is not None: | ||
| return bool(condition) | ||
| return None | ||
| if isinstance(instance, AnonymousUser): |
There was a problem hiding this comment.
I can see that you modified this because the UserConditionSet overrides the is_active and you passed in the switch_type but has it been refactored as well in the same time? Because is hard to understand if the logic has changed. Is hard to review this bit...
| >>> gargoyle.is_active('my_feature', request) | ||
| """ | ||
| default = kwargs.pop('default', False) | ||
| flag_type = kwargs.pop('flag_type', FEATURE) |
There was a problem hiding this comment.
let's keep the naming consistent to switch_type
| field_condition = (*field_condition, FEATURE) | ||
| status, condition, condition_type = field_condition | ||
|
|
||
| if switch_type != condition_type: # Ignore condition with no switch type |
There was a problem hiding this comment.
when would this situation happen?
| return value | ||
|
|
||
| def has_active_condition(self, conditions, instances): | ||
| def has_active_condition(self, conditions, instances, switch_type=FEATURE): |
There was a problem hiding this comment.
I would use condition_type instead of switch_type
| """ Returns an empty object which can get new fields in execution time """ | ||
| return type("", (), {}) | ||
|
|
||
| def _create_contitions(self, conditions): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modified the Gargoyle package to accept a flag for A/B testing