aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_submission.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove requirement that audio/video dependencies must be installed for testsChristopher Allan Webber2016-03-181-61/+145
| | | | | | | Some tests were added for running audio and video submission tests in test_submission.py. Unfortunately these were not skipped if these dependencies were not installed. This patch attempts to fix that while leaving the tests intact.
* Issue #5349: Submission tests fail confusingly on missing dependencyChristopher Allan Webber2016-02-041-0/+21
| | | | | They gave a DetachedInstanceError, despite being totally unrelated to anything in database-land!
* Add test to check that an activity is created when a collection was chosen.tom2016-01-071-4/+11
|
* Add collection drop down to submit page.tom2016-01-071-1/+59
|
* Comment changes for federationJessica Tallon2015-10-201-2/+8
| | | | | | | | | | | | | | This adds a new Comment link table that is used to link between some object and then the comment object, which can be more or less any object in Mediagoblin. The MediaComment has been renamed to TextComment as that more aptly describes what it is. There is migrations for these changes. There is also the conslidation of the Report tables into a single Report table, the same with the Notification objects. This is because both of them split out MediaEntry and Comment versions into their own polymorphic versions from a base, this is no longer a meaningful distinction as comments can be anything.
* Add public_id fixes throughout the codeJessica Tallon2015-10-071-0/+10
| | | | | | | | This adds several things, mainly code which checks for the public id and if it doesn't exist generating it where it can. This is to because we need to keep the public_id to be able to effectively soft delete models. This also adds a public_id field to the Activity along with a migration.
* Fix some unit tests and bugsJessica Tallon2015-08-241-1/+1
| | | | | | | | | | | | | | | | | | This fixes a lot of the issues with the LocalUser changes that were merged recently. There was a problem where the attributes of LocalUser were not being eagerly loaded and because the Session was detached an exception was being raised when they were accessed. This also fixes some typo's which were introduced. Finally this adds a temporary fix for a potential SQLAlchemy bug, this is a bug where doing: User.query.filter(LocalUser.username == "some_username").first() does NOT yeild a user with the username "some_username" but all users on the site. The temp fix is to just query the LocalUser, this should be resolved when bug is confirmed and fixed upstream.
* Change codebase to query or create correct User modelJessica Tallon2015-07-311-2/+2
| | | | | | | The code base had many references to User.username and other specific to LocalUser attributes as that was the way it use to exist. This updates those to query on the generic User model but filtering by attributes on the LocalUser.
* added a/v submission testingBoris Bobrov2015-02-161-0/+19
|
* Merge branch 'location'Jessica Tallon2014-10-091-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Add Location model which holds textual, geolocation coordiantes or postal addresses. This migrates data off Image model metadata onto the general Location model. It also adds the ability for location to be set on MediaEntry, User, MediaComment and Collection models. The geolocation plugin has been updated so that the location can be displayed in more general places rather than explicitely on the MediaEntry view. If GPS coordiantes are set for the User the profile page will also have the OSM provided by the geolocation plugin.
| * Add location model and migrationsJessica Tallon2014-10-091-1/+1
| |
* | pdf tests: use our own pdf doc as GOOD_PDFAlon Levy2014-09-261-1/+1
| | | | | | | | remove non distributable good.pdf
* | Fix tests on Python 3.Berker Peksag2014-07-141-4/+6
| |
* | Use six.text_type instead of unicode().Berker Peksag2014-06-021-1/+2
| | | | | | | | I will be switch to use ``from __future__ import unicode_literals`` later.
* | Use six.moves.urllib.parse instead of the urlparse module.Berker Peksag2014-05-261-1/+2
|/
* Fixing issues in the tests caused by the OPW-Moderation-Update mergeChristopher Allan Webber2013-10-081-45/+17
| | | | | | | | | Not that branch's fault! Just both that branch and master had both done a lot of changes to overlapping code. self.test_user switched to self.our_user(). Updating everywhere. This commit sponsored by Sam Kleinman. Thank you! :)
* Merge remote-tracking branch 'refs/remotes/tilly-q/OPW-Moderation-Update'Christopher Allan Webber2013-10-071-10/+20
|\ | | | | | | | | | | | | Conflicts: mediagoblin/templates/mediagoblin/user_pages/user.html mediagoblin/tests/test_auth.py mediagoblin/tests/test_submission.py
| * This commit was solely to remove unused imports in the code that I have writtentilly-Q2013-09-231-1/+1
| |
| * I did some more code-keeping in this commit. I added a lot of documentation, sotilly-Q2013-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that most of my functions do indeed have effective docstrings. I also changed the decorators so that they imply eachother in a logical way. I also modified the one decorator get_media_comment_by_id to be more usable with the variable urls of mediagoblin.user_pages.views:file_a_report. I also noticed a few tests had broken, so I went through them and fixed them up, finding that mostly there were problems in my actual writing of the tests. I also did a few other small tasks such as creating a new User method to check whether or not a User is ban- -ned. =============================================================================== Added in documentation =============================================================================== --\ mediagoblin/db/models.py --\ mediagoblin/decorators.py --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/tools.py --\ mediagoblin/moderation/views.py --\ mediagoblin/user_pages/lib.py =============================================================================== Rearranged decorators to be more efficient =============================================================================== --\ mediagoblin/decorators.py --| Made it so that user_not_banned is encapsulated in require_active_login --| Made it so that require_active_login is encapsulated in user_has_privilege --| Changed get_media_comment_by_id into get_optional_media_comment_by_id. It | now returns valid code if the MediaComment id is absent. This makes it pos- | -sible to use this decorator for the function: | mediagoblin.user_pages.views:file_a_report --\ mediagoblin/user_pages/views.py --| Replaced the mediagoblin.user_pages.views:file_a_comment_report with the | decorator mentioned above --\ mediagoblin/user_pages/routing.py ----------------------------------------------------------- | took out unnecessary @user_not_banned decorators | ----------------------------------------------------------- --\ mediagoblin/submit/views.py --\ mediagoblin/user_pages/views.py =============================================================================== Fixed broken tests =============================================================================== --\ mediagoblin/tests/test_auth.py --\ mediagoblin/tests/test_privileges.py --\ mediagoblin/tests/test_submission.py =============================================================================== Fixed broken code =============================================================================== --\ mediagoblin/tools/response.py =============================================================================== Other Tasks =============================================================================== --\ mediagoblin/db/models.py --| Added in User.is_banned() method --\ mediagoblin/decorators.py --| Utitilized User.is_banned() method in the user_not_banned decorator --\ mediagoblin/moderation/views.py --| Made it impossible for an admin to ban themself. --| Got rid of a vestigial print statement --\ mediagoblin/templates/mediagoblin/base.html --| Made it so the top panel does not show up for users that are banned. --\ mediagoblin/templates/mediagoblin/moderation/user.html --| Rearranged the javascript slightly ===============================================================================
| * This was a big commit! I included lots of documentation below, but generally Itilly-Q2013-08-291-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | did a few things. I wrote many many many new tests, either in old test files or in the three new test files I made. I also did some code-keeping work, deleting trailing whitespace and deleting vestigial code. Lastly, I fixed the parts of the code which I realized were broken thru the process of running tests. =============================================================================== Deleted trailing whitespace: =============================================================================== --\ mediagoblin/decorators.py --\ mediagoblin/auth/tools.py --\ mediagoblin/db/migrations.py --\ mediagoblin/db/models.py --\ mediagoblin/gmg_commands/users.py --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/tools.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/moderation/media_panel.html --\ mediagoblin/templates/mediagoblin/moderation/report.html --\ mediagoblin/templates/mediagoblin/moderation/report_panel.html --\ mediagoblin/templates/mediagoblin/moderation/user.html --\ mediagoblin/templates/mediagoblin/moderation/user_panel.html --\ mediagoblin/templates/mediagoblin/user_pages/report.html --\ mediagoblin/templates/mediagoblin/utils/report.html --\ mediagoblin/user_pages/lib.py --\ mediagoblin/user_pages/views.py =============================================================================== Deleted Vestigial Code =============================================================================== --\ mediagoblin/db/util.py --\ mediagoblin/tests/test_notifications.py =============================================================================== Modified the Code: =============================================================================== --\ mediagoblin/moderation/tools.py --| Encapsulated the code around giving/taking away privileges into two | funtions. --\ mediagoblin/moderation/views.py --| Imported and used the give/take away privilege functions --| Replaced 'require_admin_or_moderator_login' with |'user_has_privilege(u"admin")' for adding/taking away privileges, only | admins are allowed to do this. --\ mediagoblin/templates/mediagoblin/banned.html --| Added relevant translation tags --| Added ability to display indefinite banning --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Made sure the add comments button was only visible for users with the | `commenter` privilege --\ mediagoblin/tests/test_submission.py --| Paroneayea fixed a DetachedInstanceError I was having with the our_user | function --\ mediagoblin/tests/tools.py --| Added a fixture_add_comment_report function for testing. --\ mediagoblin/tools/response.py --| Fixed a minor error where a necessary return statement was missing --| Fit the code within 80 columns --\ mediagoblin/user_pages/views.py --| Added a necessary decorator to ensure that only users with the 'commenter' | privilege can post comments =============================================================================== Wrote new tests for an old test file: =============================================================================== --\ mediagoblin/tests/test_auth.py --| Added a new test to make sure privilege granting on registration happens | correctly --\ mediagoblin/tests/test_modelmethods.py* --| Added a test to ensure the User method has_privilege works properly =============================================================================== Wrote entirely new files full of tests: =============================================================================== --\ mediagoblin/tests/test_moderation.py --\ mediagoblin/tests/test_privileges.py --\ mediagoblin/tests/test_reporting.py =============================================================================== =============================================================================== NOTE: Any files I've marked with a * in this commit report, were actually subm- itted in my last commit. I made that committ to fix an error I was having, so they weren't properly documented in that report. =============================================================================== ===============================================================================
| * pushing so paroneayea can help me resolve a conflict within the tests.tilly-Q2013-08-231-3/+3
| |
| * This commit was just to fix a few of the errors with the merging and totilly-Q2013-08-201-1/+1
| | | | | | | | make sure that all of the previous tests work fine.
* | added testsRodney Ewing2013-08-261-8/+8
| |
* | fixed tests and defaultsRodney Ewing2013-08-261-0/+8
| |
* | fixed testsRodney Ewing2013-08-261-8/+0
| |
* | fixed tests and defaultsRodney Ewing2013-08-261-0/+8
| |
* | fixed tests and defaultsRodney Ewing2013-08-261-6/+40
| |
* | added testsRodney Ewing2013-08-261-1/+67
|/
* Merge branch 'rodney757-media_plugins'Christopher Allan Webber2013-07-121-2/+2
|\ | | | | | | | | | | Conflicts: mediagoblin.ini mediagoblin/tests/test_mgoblin_app.ini
| * Switch the import of the image media manager over to the new classChristopher Allan Webber2013-07-121-2/+2
| | | | | | | | | | | | | | This helps resolve one of the remaining issues with the tests for the media type pluginification. This commit sponsored by Jeffrey Moe. Thanks Jeff! Lulzbot rocks!
* | Patch by Strum. Ticket #451 - Convert all mongokit style .find, .find_one, ↵Rodney Ewing2013-07-111-5/+5
|/ | | | .one calls over to SQLAlchemy queries
* Reverting "Always activate testing in every test module ever."Christopher Allan Webber2013-05-171-5/+0
| | | | | | Revert "Always activate testing in every test module ever." This reverts commit 0536306048daa0970d2e43411ba2a9bf073e570e.
* Always activate testing in every test module ever.Christopher Allan Webber2013-05-161-0/+5
| | | | Kind of a dorky way to implement this, but...
* image resizing: Refactor some decisions into resize_tool.Elrond2013-04-271-1/+1
| | | | | | | Loading the thumb/medium sizes from the config, saving things to the db, and loading the image is now all done by resize_tool. It still calls resize_image for the actual work.
* at pytest author's advice, changing the way _setup back to -> setupChristopher Allan Webber2013-04-181-37/+15
| | | | | They showed me how to use @pytest.fixture, which allowed us to pass the test into setup!
* Turning image's media manager into a new style class.Elrond2013-04-171-1/+1
| | | | | images are the first media type to use the new style class based media manager.
* First step towards a MediaManager class: Compat one.Elrond2013-04-171-1/+2
| | | | | | To get us moving towards a MediaManager class, the first idea is to create a class that wraps our current dict based manager and makes all users happy.
* Refactor test resources into new resources.pyElrond2013-04-171-15/+2
|
* 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>