Skip to content

Commit

Permalink
Fix some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
znick committed Aug 30, 2022
1 parent 9539e01 commit 358c483
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions anytask/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ def test_get_issue(self, username=None, password=None):
self.assertDictEqual(issue, response_data)

response = self.client.get(url)
content = ''.join(response.streaming_content)
self.assertEqual('print "_failed_"', content)
content = b''.join(response.streaming_content)
self.assertEqual(b'print "_failed_"', content)

def test_get_issue_no_access(self):
response = self._request(self.anytask, self.anytask_password,
Expand Down
2 changes: 1 addition & 1 deletion anytask/index/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_switch_lang(self):
self.assertEqual(response.status_code, 200)

response = self.client.get(reverse('get_lang'))
self.assertEqual(response.content, lang)
self.assertEqual(response.content.decode("utf-8"), lang)

def test_switch_wrong(self):
response = self.client.get(reverse('get_lang'))
Expand Down
2 changes: 1 addition & 1 deletion anytask/issues/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Replace this with more appropriate tests for your application.
"""
from StringIO import StringIO
from io import StringIO
from unittest import skipIf

from django.core.management import call_command
Expand Down
8 changes: 6 additions & 2 deletions anytask/users/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,13 @@ def test_reset_password(self):
self.assert_(change_password_url_match)
change_password_url = change_password_url_match.group(1)

# change_password_url redirects to real change password form
response = client.get(change_password_url, follow=True)
change_password_url_post = response.redirect_chain[-1][0]

# finnaly set new password
form_data = {"new_password1": u"qwer", "new_password2": u"qwer"}
response = client.post(change_password_url, form_data, follow=True)
form_data = {"new_password1": new_password, "new_password2": new_password}
response = client.post(change_password_url_post, form_data, follow=True)
self.assertEqual(response.status_code, 200) # password changed!

# check new password finally set
Expand Down
2 changes: 1 addition & 1 deletion deploy_local_beta/generate_test_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ANYBETA_crash_on_error
$ANYBETA_ROOT/anytask/manage.py createsuperuser --username=anytask [email protected] --noinput
ANYBETA_crash_on_error

echo 'from django.contrib.auth.models import User ; user=User.objects.get(username="anytask") ; user.set_password("pass") ; user.save() ; print "Password changed"' | $ANYBETA_ROOT/anytask/manage.py shell --plain
echo 'from django.contrib.auth.models import User ; user=User.objects.get(username="anytask") ; user.set_password("pass") ; user.save() ; print("Password changed")' | $ANYBETA_ROOT/anytask/manage.py shell --plain
ANYBETA_crash_on_error

ANYBETA_report "root"
Expand Down
2 changes: 1 addition & 1 deletion deploy_local_beta/settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
export ANYBETA_ROOT=$PWD
export ANYBETA_DEPLOY="$PWD/deploy_local_beta"

export ANYBETA_PYTHON_PATH="/usr/bin/python"
export ANYBETA_PYTHON_PATH="`which python3`"

export ANYBETA_VENV_NAME="anytask_venv"
export ANYBETA_VENV_DIR="$ANYBETA_ROOT/$ANYBETA_VENV_NAME"
Expand Down

0 comments on commit 358c483

Please sign in to comment.