Skip to content

Commit

Permalink
fix the test suite in django 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
brad committed Mar 24, 2015
1 parent 6b731b8 commit fa23aba
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions misfitapp/tests/base.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
from mock import patch, Mock
import django
import random
try:
from urllib.parse import urlencode
from string import ascii_letters
except:
# Python 2.x
from urllib import urlencode
from string import letters as ascii_letters

from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase

from misfit import Misfit, MisfitProfile
from mock import patch, Mock

from misfitapp.models import MisfitUser

try:
from urllib.parse import urlencode
from string import ascii_letters
except: # Python 2.x
from urllib import urlencode
from string import letters as ascii_letters


class MisfitTestBase(TestCase):
TEST_SERVER = 'http://testserver'
Expand Down Expand Up @@ -63,8 +63,9 @@ def assertRedirectsNoFollow(self, response, url, status_code=302):
loading the page at that URL.
"""
self.assertEqual(response.status_code, status_code)
full_url = self.TEST_SERVER + url
self.assertEqual(response._headers['location'][1], full_url)
if django.VERSION < (1,9):
url = self.TEST_SERVER + url
self.assertEqual(response._headers['location'][1], url)

def _get(self, url_name=None, url_kwargs=None, get_kwargs=None, **kwargs):
"""Convenience wrapper for test client GET request."""
Expand Down

0 comments on commit fa23aba

Please sign in to comment.