aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_submission.py
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2012-03-22 01:27:19 +0100
committerJoar Wandborg <git@wandborg.com>2012-03-22 01:27:19 +0100
commita9d84d4cb79252549d472f9f2059b45bbce4f4f1 (patch)
treee3b2301a34cacef2d40a2542a63f06f490faf32c /mediagoblin/tests/test_submission.py
parent9743ce886ab3655662afaa0ef7b08791a65e37da (diff)
downloadmediagoblin-a9d84d4cb79252549d472f9f2059b45bbce4f4f1.tar.lz
mediagoblin-a9d84d4cb79252549d472f9f2059b45bbce4f4f1.tar.xz
mediagoblin-a9d84d4cb79252549d472f9f2059b45bbce4f4f1.zip
Faster sniffing
- Sniffing now goes through the old extension-based filter before doing it the bitsniffing way. - Refractored get_media_type_and_manager(filename). - Removed ogg extension from video accepted extensions, audio will take care of that. - Added custom audio player, still WIP,but working. - Added test for sniffing. This only tests for the mediagoblin.media_types.image type, as that is the only one enabled from start.
Diffstat (limited to 'mediagoblin/tests/test_submission.py')
-rw-r--r--mediagoblin/tests/test_submission.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py
index 53ba25d8..702741b4 100644
--- a/mediagoblin/tests/test_submission.py
+++ b/mediagoblin/tests/test_submission.py
@@ -219,6 +219,28 @@ class TestSubmission:
request.db.MediaEntry.find(
{'_id': media._id}).count())
+ def test_sniffing(self):
+ '''
+ Test sniffing mechanism to assert that regular uploads work as intended
+ '''
+ template.clear_test_template_context()
+ response = self.test_app.post(
+ '/submit/', {
+ 'title': 'UNIQUE_TITLE_PLS_DONT_CREATE_OTHER_MEDIA_WITH_THIS_TITLE'
+ }, upload_files=[(
+ 'file', GOOD_JPG)])
+
+ response.follow()
+
+ context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/user_pages/user.html']
+
+ request = context['request']
+
+ media = request.db.MediaEntry.find_one({
+ u'title': u'UNIQUE_TITLE_PLS_DONT_CREATE_OTHER_MEDIA_WITH_THIS_TITLE'})
+
+ assert media.media_type == 'mediagoblin.media_types.image'
+
def test_malicious_uploads(self):
# Test non-suppoerted file with non-supported extension
# -----------------------------------------------------