diff options
Diffstat (limited to 'mediagoblin/tests/test_util.py')
-rw-r--r-- | mediagoblin/tests/test_util.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/mediagoblin/tests/test_util.py b/mediagoblin/tests/test_util.py index 36563e75..8193233f 100644 --- a/mediagoblin/tests/test_util.py +++ b/mediagoblin/tests/test_util.py @@ -14,12 +14,17 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -import mock +try: + import mock +except ImportError: + import unittest.mock as mock import email import pytest import smtplib import pkg_resources +import six + from mediagoblin.tests.tools import get_app from mediagoblin.tools import common, url, translate, mail, text, testing @@ -57,7 +62,7 @@ I hope you like unit tests JUST AS MUCH AS I DO!""") assert message['From'] == "sender@mediagoblin.example.org" assert message['To'] == "amanda@example.org, akila@example.org" assert message['Subject'] == "Testing is so much fun!" - assert message.get_payload(decode=True) == """HAYYY GUYS! + assert message.get_payload(decode=True) == b"""HAYYY GUYS! I hope you like unit tests JUST AS MUCH AS I DO!""" @@ -70,7 +75,7 @@ I hope you like unit tests JUST AS MUCH AS I DO!""" assert mbox_message['From'] == "sender@mediagoblin.example.org" assert mbox_message['To'] == "amanda@example.org, akila@example.org" assert mbox_message['Subject'] == "Testing is so much fun!" - assert mbox_message.get_payload(decode=True) == """HAYYY GUYS! + assert mbox_message.get_payload(decode=True) == b"""HAYYY GUYS! I hope you like unit tests JUST AS MUCH AS I DO!""" @@ -144,13 +149,13 @@ def test_gettext_lazy_proxy(): orig = u"Password" set_thread_locale("es") - p1 = unicode(proxy) + p1 = six.text_type(proxy) p1_should = pass_to_ugettext(orig) assert p1_should != orig, "Test useless, string not translated" assert p1 == p1_should set_thread_locale("sv") - p2 = unicode(proxy) + p2 = six.text_type(proxy) p2_should = pass_to_ugettext(orig) assert p2_should != orig, "Test broken, string not translated" assert p2 == p2_should |