This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bug 630718] Hash string filter values down to ints. Recreate your ta…
…bles. Not factoring up search app's implementation of crc32() since the notifications app is going to break off anyway.
- Loading branch information
Showing
6 changed files
with
74 additions
and
8 deletions.
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
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 |
---|---|---|
@@ -1,3 +1,24 @@ | ||
from nose.tools import eq_ | ||
|
||
from notifications.models import WatchFilter | ||
from notifications.tests import watch_filter | ||
from sumo.tests import TestCase | ||
|
||
|
||
# TODO: write a test to ensure that event types don't collide | ||
# case-insensitive-ly | ||
# E.g. No duplicates in this list: [et.lower() for et in EVENT_TYPES] | ||
|
||
|
||
class WatchFilterTests(TestCase): | ||
"""Tests for WatchFilter""" | ||
|
||
def test_value_range(self): | ||
"""Assert 0 and 2**32-1 both fit in the value field. | ||
That's the range of our hash function. | ||
""" | ||
MAX_INT = 2 ** 32 - 1 | ||
watch_filter(name='maxint', value=MAX_INT).save() | ||
eq_(MAX_INT, WatchFilter.objects.get(name='maxint').value) |
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