Last two issues related to the python 3 merge tests: fixed!
- Fix the "pulling the error out of excinfo" stuff for py3 - The u"" only gets embedded in the string on py2. This commit sponsored by Jeff Gibson. Thanks, Jeff! :)
This commit is contained in:
parent
1db2bd3fe7
commit
6430ae97ec
@ -145,7 +145,7 @@ class TestAPI(object):
|
|||||||
headers=headers
|
headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "403 FORBIDDEN" in excinfo.value.message
|
assert "403 FORBIDDEN" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_unable_to_post_feed_as_someone_else(self, test_app):
|
def test_unable_to_post_feed_as_someone_else(self, test_app):
|
||||||
""" Tests that can't post an image to someone else's feed """
|
""" Tests that can't post an image to someone else's feed """
|
||||||
@ -168,7 +168,7 @@ class TestAPI(object):
|
|||||||
headers=headers
|
headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "403 FORBIDDEN" in excinfo.value.message
|
assert "403 FORBIDDEN" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_only_able_to_update_own_image(self, test_app):
|
def test_only_able_to_update_own_image(self, test_app):
|
||||||
""" Test's that the uploader is the only person who can update an image """
|
""" Test's that the uploader is the only person who can update an image """
|
||||||
@ -200,7 +200,7 @@ class TestAPI(object):
|
|||||||
headers=headers
|
headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "403 FORBIDDEN" in excinfo.value.message
|
assert "403 FORBIDDEN" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_upload_image_with_filename(self, test_app):
|
def test_upload_image_with_filename(self, test_app):
|
||||||
""" Tests that you can upload an image with filename and description """
|
""" Tests that you can upload an image with filename and description """
|
||||||
@ -263,7 +263,7 @@ class TestAPI(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Assert that we've got a 403
|
# Assert that we've got a 403
|
||||||
assert "403 FORBIDDEN" in excinfo.value.message
|
assert "403 FORBIDDEN" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_object_endpoint(self, test_app):
|
def test_object_endpoint(self, test_app):
|
||||||
""" Tests that object can be looked up at endpoint """
|
""" Tests that object can be looked up at endpoint """
|
||||||
@ -354,7 +354,7 @@ class TestAPI(object):
|
|||||||
headers=headers
|
headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "403 FORBIDDEN" in excinfo.value.message
|
assert "403 FORBIDDEN" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_unable_to_update_someone_elses_comment(self, test_app):
|
def test_unable_to_update_someone_elses_comment(self, test_app):
|
||||||
""" Test that you're able to update someoen elses comment. """
|
""" Test that you're able to update someoen elses comment. """
|
||||||
@ -399,7 +399,7 @@ class TestAPI(object):
|
|||||||
headers=headers
|
headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "403 FORBIDDEN" in excinfo.value.message
|
assert "403 FORBIDDEN" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_profile(self, test_app):
|
def test_profile(self, test_app):
|
||||||
""" Tests profile endpoint """
|
""" Tests profile endpoint """
|
||||||
@ -436,7 +436,7 @@ class TestAPI(object):
|
|||||||
with pytest.raises(AppError) as excinfo:
|
with pytest.raises(AppError) as excinfo:
|
||||||
response = test_app.get("/api/whoami")
|
response = test_app.get("/api/whoami")
|
||||||
|
|
||||||
assert "401 UNAUTHORIZED" in excinfo.value.message
|
assert "401 UNAUTHORIZED" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_read_feed(self, test_app):
|
def test_read_feed(self, test_app):
|
||||||
""" Test able to read objects from the feed """
|
""" Test able to read objects from the feed """
|
||||||
@ -471,7 +471,7 @@ class TestAPI(object):
|
|||||||
with pytest.raises(AppError) as excinfo:
|
with pytest.raises(AppError) as excinfo:
|
||||||
self._post_image_to_feed(test_app, data)
|
self._post_image_to_feed(test_app, data)
|
||||||
|
|
||||||
assert "403 FORBIDDEN" in excinfo.value.message
|
assert "403 FORBIDDEN" in excinfo.value.args[0]
|
||||||
|
|
||||||
def test_object_endpoint_requestable(self, test_app):
|
def test_object_endpoint_requestable(self, test_app):
|
||||||
""" Test that object endpoint can be requested """
|
""" Test that object endpoint can be requested """
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import six
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -252,5 +253,9 @@ class TestMetaDataEdit:
|
|||||||
assert new_metadata == old_metadata
|
assert new_metadata == old_metadata
|
||||||
context = template.TEMPLATE_TEST_CONTEXT[
|
context = template.TEMPLATE_TEST_CONTEXT[
|
||||||
'mediagoblin/edit/metadata.html']
|
'mediagoblin/edit/metadata.html']
|
||||||
assert context['form'].errors['media_metadata'][0]['identifier'][0] == \
|
if six.PY2:
|
||||||
"'On the worst day' is not a 'date-time'"
|
expected = "u'On the worst day' is not a 'date-time'"
|
||||||
|
else:
|
||||||
|
expected = "'On the worst day' is not a 'date-time'"
|
||||||
|
assert context['form'].errors[
|
||||||
|
'media_metadata'][0]['identifier'][0] == expected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user