Skip to content

Commit

Permalink
Temporary fix for Django>=1.5 tests
Browse files Browse the repository at this point in the history
Add a temporary fix for the url resolving of tests that hit the same url
multiple times. It seems that Django>=1.5 puts them in a list, which is
not hashable and therefore the resolving fails with TypeError.
  • Loading branch information
Alex Pyrgiotis committed Jun 20, 2014
1 parent 3c8c60d commit 698063e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions eztables/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ def test_filter_set(self):


class ArrayMixin(object):

urls = patterns('',
url(r'^$', BrowserDatatablesView.as_view(), name='browsers'),
url(r'^formatted/$', FormattedBrowserDatatablesView.as_view(), name='formatted-browsers'),
Expand All @@ -935,6 +936,12 @@ class ArrayMixin(object):
name='filter_set'),
)

class MockUrlConf(object):
def __init__(self, patterns):
self.urlpatterns = patterns

urlconfclass = MockUrlConf(urls)

def value(self, row, field_id):
return row[field_id]

Expand Down Expand Up @@ -970,6 +977,12 @@ class ObjectMixin(object):
name='filter_set'),
)

class MockUrlConf(object):
def __init__(self, patterns):
self.urlpatterns = patterns

urlconfclass = MockUrlConf(urls)

id_to_name = {
0: 'engine',
1: 'name',
Expand Down Expand Up @@ -1002,12 +1015,12 @@ def assertRowUpper(self, row):

class GetMixin(object):
def get_response(self, name, data={}):
return self.client.get(reverse(name), data)
return self.client.get(reverse(name, self.urlconfclass), data)


class PostMixin(object):
def get_response(self, name, data={}):
return self.client.post(reverse(name), data)
return self.client.get(reverse(name, self.urlconfclass), data)


class DatatablesArrayGetTest(ArrayMixin, GetMixin, DatatablesTestMixin, TestCase):
Expand Down

0 comments on commit 698063e

Please sign in to comment.