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.
This commit is contained in:
@@ -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
|
||||
# -----------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user