aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_util.py
diff options
context:
space:
mode:
authorAaron Williamson <aaron@copiesofcopies.org>2011-10-01 18:05:44 -0400
committerAaron Williamson <aaron@copiesofcopies.org>2011-10-01 18:05:44 -0400
commit152a3bfaa36d58e44979f217c5799531f780250f (patch)
tree90b7155c2241c5040bd1d3c1bacef9252c1a3d11 /mediagoblin/tests/test_util.py
parent03ae172a60a87625e5281eb9766aa5bf3e37d0f4 (diff)
downloadmediagoblin-152a3bfaa36d58e44979f217c5799531f780250f.tar.lz
mediagoblin-152a3bfaa36d58e44979f217c5799531f780250f.tar.xz
mediagoblin-152a3bfaa36d58e44979f217c5799531f780250f.zip
Finished splitting util.py into separate files.
Diffstat (limited to 'mediagoblin/tests/test_util.py')
-rw-r--r--mediagoblin/tests/test_util.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/mediagoblin/tests/test_util.py b/mediagoblin/tests/test_util.py
index cdc62b7d..48fa8669 100644
--- a/mediagoblin/tests/test_util.py
+++ b/mediagoblin/tests/test_util.py
@@ -16,10 +16,9 @@
import email
-from mediagoblin import util
-from mediagoblin.tools import url, translate
+from mediagoblin.tools import common, url, translate, mail, text, testing
-util._activate_testing()
+testing._activate_testing()
def _import_component_testing_method(silly_string):
@@ -28,7 +27,7 @@ def _import_component_testing_method(silly_string):
def test_import_component():
- imported_func = util.import_component(
+ imported_func = common.import_component(
'mediagoblin.tests.test_util:_import_component_testing_method')
result = imported_func('hooobaladoobala')
expected = u"'hooobaladoobala' is the silliest string I've ever seen"
@@ -36,10 +35,10 @@ def test_import_component():
def test_send_email():
- util._clear_test_inboxes()
+ mail._clear_test_inboxes()
# send the email
- util.send_email(
+ mail.send_email(
"sender@mediagoblin.example.org",
["amanda@example.org", "akila@example.org"],
"Testing is so much fun!",
@@ -48,8 +47,8 @@ def test_send_email():
I hope you like unit tests JUST AS MUCH AS I DO!""")
# check the main inbox
- assert len(util.EMAIL_TEST_INBOX) == 1
- message = util.EMAIL_TEST_INBOX.pop()
+ assert len(mail.EMAIL_TEST_INBOX) == 1
+ message = mail.EMAIL_TEST_INBOX.pop()
assert message['From'] == "sender@mediagoblin.example.org"
assert message['To'] == "amanda@example.org, akila@example.org"
assert message['Subject'] == "Testing is so much fun!"
@@ -58,8 +57,8 @@ I hope you like unit tests JUST AS MUCH AS I DO!""")
I hope you like unit tests JUST AS MUCH AS I DO!"""
# Check everything that the FakeMhost.sendmail() method got is correct
- assert len(util.EMAIL_TEST_MBOX_INBOX) == 1
- mbox_dict = util.EMAIL_TEST_MBOX_INBOX.pop()
+ assert len(mail.EMAIL_TEST_MBOX_INBOX) == 1
+ mbox_dict = mail.EMAIL_TEST_MBOX_INBOX.pop()
assert mbox_dict['from'] == "sender@mediagoblin.example.org"
assert mbox_dict['to'] == ["amanda@example.org", "akila@example.org"]
mbox_message = email.message_from_string(mbox_dict['message'])
@@ -107,7 +106,7 @@ def test_locale_to_lower_lower():
def test_html_cleaner():
# Remove images
- result = util.clean_html(
+ result = text.clean_html(
'<p>Hi everybody! '
'<img src="http://example.org/huge-purple-barney.png" /></p>\n'
'<p>:)</p>')
@@ -118,7 +117,7 @@ def test_html_cleaner():
'</div>')
# Remove evil javascript
- result = util.clean_html(
+ result = text.clean_html(
'<p><a href="javascript:nasty_surprise">innocent link!</a></p>')
assert result == (
'<p><a href="">innocent link!</a></p>')