forked from disqus/gargoyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed removing conditions in the UI where the value is the empty string
Fixes disqus#55. The API the frontend uses is untested, maybe some tests would have caught it.
- Loading branch information
1 parent
b203c7a
commit 27fc51d
Showing
3 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -590,6 +590,23 @@ def test_remove_condition(self): | |
assert not self.gargoyle.is_active('test', user5) | ||
assert not self.gargoyle.is_active('test', user8771) | ||
|
||
def test_add_condition_empty(self): | ||
condition_set = 'gargoyle.builtins.UserConditionSet(auth.user)' | ||
|
||
switch = Switch.objects.create(key='test', status=SELECTIVE) | ||
switch = self.gargoyle['test'] | ||
|
||
user_empty = User(email='') | ||
user_non_empty = User(email='[email protected]') | ||
switch.add_condition( | ||
condition_set=condition_set, | ||
field_name='email', | ||
condition='', | ||
) | ||
|
||
assert self.gargoyle.is_active('test', user_empty) | ||
assert not self.gargoyle.is_active('test', user_non_empty) | ||
|
||
def test_switch_defaults(self): | ||
"""Test that defaults pulled from GARGOYLE_SWITCH_DEFAULTS. | ||
|