Skip to content

Instantly share code, notes, and snippets.

@cvan
Created March 1, 2012 23:00
Show Gist options
  • Save cvan/1953845 to your computer and use it in GitHub Desktop.
Save cvan/1953845 to your computer and use it in GitHub Desktop.
wonky ES
(z)(system.local) %% testme search.tests.test_views:TestESWonkiness ~/Sites/projects/zamboni2 (es-coll)
/Users/chris/Sites/projects/zamboni2/vendor/src/django/django/conf/__init__.py:72: DeprecationWarning: If set, STATIC_URL must end with a slash
DeprecationWarning)
nosetests --verbosity 2 search.tests.test_views:TestESWonkiness --with-fixture-bundling --exclude=mkt/* -s --logging-clear-handlers -a!sphinx
Reusing old database "test_zamboni_mkt". Set env var FORCE_DB=1 if you need fresh DBs.
No handlers could be found for logger "rdflib"
/Users/chris/Sites/projects/zamboni2/vendor/lib/python/paypalx/getPermissionsAuthHeader.py:4: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import random,md5,time
test (search.tests.test_views.TestESWonkiness) ... /Users/chris/Sites/projects/zamboni2/apps/addons/models.py:301: DeprecationWarning: object.__new__() takes no parameters
return super(Addon, cls).__new__(cls, *args, **kw)
FAIL
======================================================================
FAIL: test (search.tests.test_views.TestESWonkiness)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/chris/Sites/projects/zamboni2/apps/search/tests/test_views.py", line 43, in test
eq_(len(list(Addon.search())), cnt)
AssertionError: 10 != 11
----------------------------------------------------------------------
Ran 1 test in 4.428s
FAILED (failures=1)
diff --git a/apps/search/tests/test_views.py b/apps/search/tests/test_views.py
index c921bd0..0bf7b7a 100644
--- a/apps/search/tests/test_views.py
+++ b/apps/search/tests/test_views.py
@@ -27,6 +27,22 @@ from versions.models import ApplicationsVersions
from webapps.tests.test_views import PaidAppMixin
+class TestESWonkiness(amo.tests.ESTestCase):
+
+ def test(self):
+ cnt = 10
+ for x in xrange(cnt):
+ amo.tests.addon_factory(type=9)
+ self.refresh()
+ eq_(len(list(Addon.search())), cnt)
+
+ cnt = 11
+ for x in xrange(cnt):
+ amo.tests.addon_factory(type=9)
+ self.refresh()
+ eq_(len(list(Addon.search())), cnt)
+
+
def test_parse_bad_type():
"""
Given a type that doesn't exist, we should not throw a KeyError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment