aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_submission.py
Commit message (Collapse)AuthorAgeFilesLines
...
* PDF: Use pytest.mark.skipif for skipping testsElrond2013-04-161-2/+2
| | | | | | | | | | Instead of leaving test early if they can not run, use the pytest.mark.skipif marked to tell the test system not to even run the test. This also adds to the stats, because skipped tests are counted differently. Thus making it obvious, that some tests did not run, because of any reason.
* add pdf media typeAlon Levy2013-04-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | The new media type supports pdf and a subset of media recognized by libreoffice via unoconv. Every document added goes through: * conversion to pdf with unoconv if not already a pdf * creation of thumbnail and medium sized image, and pdfinfo generates some information (even for unoconv produces docs - should fix this) Poppler (pdftocairo, pdfinfo) is used. http://poppler.freedesktop.org/ A working but uglified pdf.js integration exists, which is enabled by setting pdf.pdf_js=true mediagoblin_local.ini (disabled in mediagoblin.ini) Adds one test to the test_submission test suite, and another separate test_pdf suite. The tests are only run if media_types.pdf.processing.check_prerequisites passes, so the test suite will not require any extra package. TODO: make test suite say 'skipped' in that case instead of just 'ok' Signed-off-by: Alon Levy <alon@pobox.com>
* Really removing nosetests things now! all assert_whatever removedChristopher Allan Webber2013-04-061-18/+17
|
* Switch test_app generation over to use py.test fixtures.Christopher Allan Webber2013-04-041-20/+43
| | | | | | | | | | | | By doing this, we can take advantage of py.test's ability to create temporary directories that are then cleaned up later during testing. This helps for sandboxing things. This also involves a ton of changes: - Changing the get_app stuff appropriately, getting rid of the setup_fresh_app decorator - Making said fixture - Switching over a billion tests to use it
* All mediagoblin tests now pass with py.test (switched setUp to setup)Christopher Allan Webber2013-04-031-1/+1
|
* Some tests for media_data, yeah!Elrond2013-02-011-1/+8
| | | | | | | | One in the submissions, that posts a jpg with gps data. One in the modelmethods to test some behaviours. The later test fails. Fixes coming up.
* Add (failing) test for editing the slug.Elrond2013-01-181-1/+7
| | | | | | | | | | This test fails, because it tries to set a slug with an "=" in it. And tests that the "=" gets replaced by "-". Well, it currently is not being replaced. The next (cherry picked) commit by Sebastian Spaeth fixes this test!
* Rename get_test_app to get_app.Elrond2013-01-181-2/+2
| | | | | | | nosetests runs everything that even vaguely looks like a test case... even our get_test_app. And as it is imported everywhere... it is run everywhere as a test case. Renaming it saves us about 10+ tests and a few seconds of time.
* Start to use the media_id in "admin" URLs.Elrond2013-01-111-2/+8
| | | | | | | | | | | | We have a bunch of URLs that are more for internal use. At least they're definitely not intended to be posted somewhere for long term useage. When those things affect a media, it's much better to reference the media by its id. This can't change, ever. This is better for races. Like someone posting a comment while the owner corrects a typo in the slug.
* Don't get a fresh app when not neededSebastian Spaeth2013-01-081-4/+4
| | | | | | | | These tests, don't need fresh databases, so don't discard and recreate the tables. This reduces test suite runtime on my laptop from 130 to 96 seconds. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Move DBModel._id -> DBModel.idSebastian Spaeth2012-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | We were refering to model._id in most of the code base as this is what Mongo uses. However, each use of _id required a) fixup of queries: e.g. what we did in our find() and find_one() functions moving all '_id' to 'id'. It also required using AliasFields to make the ._id attribute available. This all means lots of superfluous fixing and transitioning in a SQL world. It will also not work in the long run. Much newer code already refers to the objects by model.id (e.g. in the oauth plugin), which will break with Mongo. So let's be honest, rip out the _id mongoism and live with .id as the one canonical way to address objects. This commit modifies all users and providers of model._id to use model.id instead. This patch works with or without Mongo removed first, but will break Mongo usage (even more than before) I have not bothered to fixup db.mongo.* and db.sql.convert (which converts from Mongo to SQL) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* make media_manager a property of MediaEntry in mixin.pySebastian Spaeth2012-12-041-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | In all cases where get_media_manager(_media_type_as_string) was called in our code base we ultimately passed in a "MediaEntry().media_type" to get the matching MEDIA_MANAGER. It so makes sense to make this a function of the MediaEntry rather than a global function in mediagoblin.media_types and passing around media_entry.media_type as arguments all the time. It saves a few import statements and arguments. I also made it so the Media_manager property is cached for subsequent calls, although I am not too sure that this is needed (there are other cases for which this would make more sense) Also add a get_media_manager test to the media submission tests. It submits an image and checks that both media.media_type and media.media_manager return the right thing. Not sure if these tests could not be merged with an existing submission test, but it can't hurt to have things explicit. TODO: Right now we iterate through all existing media_managers to find the right one based on the string of its module name. This should be made a simple dict lookup to avoid all the extra work. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* More Unicode titles to prevent non-Unicode SQLAlchemy warnings.Brett Smith2012-07-081-2/+6
|
* Prevent non-Unicode SQLAlchemy warnings in most submission tests.Brett Smith2012-07-081-14/+14
| | | | This commit makes test_submission mostly warning-clean.
* Fix problems from pyflakes outputWill Kahn-Greene2012-06-031-2/+1
|
* Merge remote-tracking branch 'refs/remotes/elrond/sql/final'Christopher Allan Webber2012-04-011-12/+16
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/tests/test_submission.py Also, WHOO SQL SWITCHOVER PARTY! ASCII DANCE PARTY /_o_/ \ / \o_ o ( _|_ ) //) /\ / o \ /| /| *BMCH BMCH BMCH BMCH* % /_o_/ HHHYAAaaaaa /_ / / % AAAAAHAHAHAHAHHHAAHA ,, .------ o_o ;; /\\ \ $ __ '\/ || // \\ # /_/ \// // //\\ \ ) \\ \ % \\ \\_____\ | ) //------- /_/_ // // SWITCH YOUR DATABASE FLIP A FUKKEN BOOLEAN % __________ .-' '-. .' '. .' _--_ _--_ '. / / (_). / (_). \ . | | | | . | ._____, ._____, | | ____________________ | | | | | ' \ / ' \ '. .----./ / \ '._ / / / '. '--------' .' '._ _.' '----------'
| * Fix unit tests for sql: cache media_id.Elrond2012-04-011-2/+3
| | | | | | | | | | | | | | Attributes of SQLAlchemy objects get "lost". So "cache" them locally in the code. This is really the simple explanation for some scarry sqlalchemy details.
| * TestSubission's tag check stuff passing nowChristopher Allan Webber2012-03-261-3/+5
| |
* | Fixed test_submission -> test_evil_file testJoar Wandborg2012-03-271-3/+2
| |
* | Merge remote-tracking branch 'joar/audio+sniffing'Joar Wandborg2012-03-271-7/+30
|\ \ | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/media_types/image/processing.py mediagoblin/media_types/video/__init__.py mediagoblin/media_types/video/processing.py mediagoblin/tests/test_submission.py
| * | Faster sniffingJoar Wandborg2012-03-221-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
| * | Audio thumbnailing & spectrograms, media plugins use sniffingJoar Wandborg2012-02-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added extlib/freesound/audioprocessing.py * config_spec * Added create_spectrogram setting * Added media:medium and media:thumb max_{width,height} settings * Added sniffing logic to - audio.processing:sniff_handler - video.processing:sniff_handler * Changed audio.processing:sniff_handler logic * Added audio thumbnailing functionality to audio.processing (works only with create_spectrogram enabled) * Refractored contexts in audio.processing * Added audio.transcoders:AudioThumbnailer Used for creating spectrograms and spectrogram thumbnails - Wadsworth's Constant, we meet again :) * audio.transcoders:AudioTranscoder - Added mux_string kwarg - Delete self.pipeline on self.halt() * Changed str.format formatting in image.processing:sniff_handler Had {1} without an {0}, changed to {0} * Refractored VideoTranscoder to use transcode() for transcoding instead of __init__() * Added discover() method to video.transcoders:VideoTranscoder * Added spectrogram display to media_displays/audio.html * Updated test_submission to reflect changes in media plugin delegation
* | | Merge remote branch 'origin/master' into bug261-resized-filenamesBrett Smith2012-03-261-0/+14
|\ \ \ | | |/ | |/| | | | | | | | | | This merge involved moving the new FilenameBuilder class to processing/__init__.py, and putting the comment deletion tests back into test_submission.py using the refactored functions.
| * | When media is deleted, delete associated comments too.Brett Smith2012-03-171-0/+15
| | | | | | | | | | | | | | | | | | The actual code is just a simple for loop; there might be a better implementation but this is a fine start. I also extended test_delete to check this too.
* | | Add tests for image processing. Check filenames and image sizes.Brett Smith2012-03-201-0/+24
| | | | | | | | | | | | | | | | | | | | | This test helps verify that bug #261 is actually fixed. In order to test that all the processed images are smaller, I needed to add an image that's bigger than processing.MEDIUM_SIZE, hence bigblue.png.
* | | Make a function to generate test image filenames.Brett Smith2012-03-201-11/+9
| | |
* | | Prefer nose assert_* methods to the assert built-in.Brett Smith2012-03-201-7/+10
| | |
* | | Refactor false image tests.Brett Smith2012-03-201-28/+13
| | |
* | | Refactor normal upload tests.Brett Smith2012-03-201-27/+17
| | | | | | | | | | | | | | | This is nice because it means we do *all* the normal sanity tests for *all* the normal uploads. check_url() can be used in other tests too.
* | | Refactor MediaEntry fetches/checks into check_media().Brett Smith2012-03-201-14/+13
| | |
* | | Refactor data posts into one do_post function.Brett Smith2012-03-201-112/+52
|/ / | | | | | | | | | | All the data posts in these tests had a lot of common code. Putting all that into a function makes it easier to write more tests (which I'll be doing in a bit) and see what's really being tested.
* / Dot-Notation: MediaComment and some random placesElrond2012-02-261-3/+3
|/
* Fix copyright statements; add LICENSE for EXIF.pyWill Kahn-Greene2012-02-081-1/+0
|
* It's 2012 all up in hereChristopher Allan Webber2012-02-021-1/+1
|
* Test Suite: Enable attachments, add failing testElrond2012-01-101-0/+14
| | | | | | | | | attachments are an optional part. But it doesn't hurt to enable them in the test suite at all. Also (with enabled attachmemtns) the main media view fails, if one isn't logged in (joar found it!). So add a simple (currently failing) test for this.
* Dot-Notation for MediaEntry.stateElrond2012-01-041-2/+2
|
* ASCII media type support & fix a bug in file submission error handlingJoar Wandborg2011-12-311-1/+4
| | | | | | | | | | | | | | | * Added ASCII media processing * Added ASCII media display * Added ASCII media type Rebased from Joar Wandborg's ascii art branch (squashed to remove the commits borrowing code of dubious license) Fixed a bug in file submission error handling: - Moved file-extension condition out of loop (what did it do there?) - Updated file submission tests - Changed error handling in file submission, should now report more than absolutely necessary.
* Dot-Notation for Users.usernameElrond2011-12-051-2/+2
|
* Update the delete item to use the _id after all... it's the safest way.Christopher Allan Webber2011-12-051-2/+2
| | | | See http://bugs.foocorp.net/issues/695
* Merge remote-tracking branch ↵Christopher Allan Webber2011-12-041-2/+2
|\ | | | | | | | | | | | | | | | | 'remotes/lorochka85/bug852_use_media_slug_instead_of_id' Conflicts: mediagoblin/decorators.py mediagoblin/templates/mediagoblin/user_pages/media.html mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html
* | fixture_add_user: Factoring a unit test toolElrond2011-12-011-9/+3
| | | | | | | | | | | | | | Some unit tests need a user in the database, especially to act as that user. Some routines did that on their own. So factored this whole thing into a new function and use it around.
* | Fixes after merging video into master - part 2Joar Wandborg2011-11-211-3/+3
|/ | | | | | - Added handling of InvalidFileType to submit.views - Updated test_celery_setup and test_submission tests to reflect the changes to the media procesing infrastructure
* Dot-Notation for "_id"Elrond2011-11-151-3/+3
| | | | | | | | | Note: Migrations can't use "Dot Notation"! Migrations run on pymongo, not mongokit. So they can't use the "Dot Notation". This isn't really a big issue, as migrations are anyway quite mongo specific.
* Moved common, translation, template, and url code out of util.py and into ↵Aaron Williamson2011-10-011-21/+21
| | | | tools/[file].py
* Fixing the confirm delete unit testChristopher Allan Webber2011-09-051-2/+3
| | | | Now it's updated for the new checkbox-for-confirm code.
* 508. Updates copyright/license informationWill Kahn-Greene2011-09-011-1/+1
|
* Feature #403 - Ability to delete media entries - Fixes according to feedbackJoar Wandborg2011-08-301-2/+2
| | | | | | | | | | * Moved `mediagoblin.confirm` stuff to `mediagoblin.user_pages`, templates too. * Removed route extension for `mediagoblin.confirm` * Created `delete_media_files` which deletes all media files on the public_store when the entry is deleted * Created a new decorator to check if a user has the permission to delete an entry.
* Added tests for delete/confirm_deleteJoar Wandborg2011-08-301-1/+60
|
* Malicious uploads test with fake but not really image files working! :)Christopher Allan Webber2011-08-141-23/+36
|
* Merge remote branch 'remotes/gullydwarf-cfdv/f360_tagging' into mergetagsChristopher Allan Webber2011-07-301-0/+39
|\ | | | | | | | | Conflicts: mediagoblin/tests/test_submission.py