aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* PIL: Support systems with Pillow and withoutAlon Levy2013-04-171-1/+4
| | | | | | | Fixes for systems with Pillow, but leaves a "try: except ImportError" to support anything that doesn't have a PIL top level import. Signed-off-by: Alon Levy <alon@pobox.com>
* Refactor test resources into new resources.pyElrond2013-04-175-55/+47
|
* PDF: Use pytest.mark.skipif for skipping testsElrond2013-04-162-5/+4
| | | | | | | | | | 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.
* test_timesince() doesn't need a complete test_app.Elrond2013-04-161-1/+1
|
* Removing unused importsChristopher Allan Webber2013-04-151-5/+0
|
* add pdf media typeAlon Levy2013-04-154-0/+60
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'joar-github/oauth/refresh_tokens'Nathan Yergler2013-04-132-7/+45
|\ | | | | | | This merges the patch for Issue #548.
| * OAuth: Support refresh tokens, etcJoar Wandborg2013-04-062-8/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Initially I was going to write a failing test for refresh tokens. Thus this fix includes an orphaned 'expect_failure' method in test utils. I ended up writing support for OAuth refresh tokens, as well as a lot of cleanup (hopefully) in the OAuth plugin code. **Rebase**: While waiting for this stuff to be merged, the testing framework changed, it comes with batteries included regarding fails. Removed legacy nosetest helper. Also added a lot of backref=backref([...], cascade='all, delete-orphan')
* | Merge remote-tracking branch 'refs/remotes/tsyesika/394-fuzzy-timestamp'Christopher Allan Webber2013-04-131-0/+57
|\ \
| * | Adds the unit tests and removes useless function we don't useJessica T2013-04-121-0/+57
| | |
* | | Merge branch '637_friendlier_hooks'Christopher Allan Webber2013-04-105-0/+243
|\ \ \ | |/ / |/| |
| * | callable hook convenience functions.. now work, and with tests!Christopher Allan Webber2013-04-105-3/+135
| | | | | | | | | | | | | | | | | | | | | | | | - Added three "callables" test plugins. - updated callable_runone to check for unhandled_okay in the kwargs dict. All passing!
| * | tests for new pluginapi methods that can't possibly pass yet :)Christopher Allan Webber2013-04-091-0/+111
| | |
* | | Remove the last traces of beaker.Elrond2013-04-092-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | There were still some traces of beaker around: - docs: replaced by reference to itsdangerous. - paste configs: Wiped away. - config_spec.ini: wiped. - test_mgoblin_app.ini: also wiped.
* | | Merge remote-tracking branch 'brett/itsdangerous'Elrond2013-04-093-53/+31
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * brett/itsdangerous: Call is_updated instead of testing it boolean. Harden It's Dangerous key management. First tests for the Session class. Set a starting value for session.send_new_cookie. Remove beaker stuff from the code. Delete the session cookie on an empty session. Back sessions with It's Dangerous. Improve fs security for itsdangerous secret. Docs for get_timed_signer_url. Basic itsdangerous infrastructure. Conflicts: mediagoblin/tests/test_cache.py
| * | | First tests for the Session class.Brett Smith2013-03-241-0/+30
| | | |
| * | | Remove beaker stuff from the code.Brett Smith2013-03-242-55/+1
| | | | | | | | | | | | | | | | This is all obsoleted by It's Dangerous.
* | | | Testing: Remove some left over files/dirs.Elrond2013-04-082-2/+35
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using tempfile.* in testing, those files get created in the system tempdir. The docs say, we should try to remove them. Yes, the next reboot will clean them up also. And in the workbench case, check after each test, that the global workbench dir is empty (so the sub-workbcnhes have been destroyed).
* | | Really removing nosetests things now! all assert_whatever removedChristopher Allan Webber2013-04-0611-96/+75
| |/ |/|
* | Switch test_app generation over to use py.test fixtures.Christopher Allan Webber2013-04-0418-251/+248
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Oops, forgot to assign dump_old_app to self, heh.Christopher Allan Webber2013-04-041-0/+1
| |
* | Turning setup_fresh_app into SetupFreshApp, a decorator with options!Christopher Allan Webber2013-04-041-8/+18
| | | | | | | | This way people can pass in particular paste/mediagoblin configs that they want to use.
* | Updating get_app to allow for passing in particular app configsChristopher Allan Webber2013-04-041-2/+17
| |
* | These tests need to have a MediaGoblin app setup so they can connect to the db!Christopher Allan Webber2013-04-032-0/+3
| | | | | | | | Thanks to py.test --boxed for helping discover that ;)
* | All mediagoblin tests now pass with py.test (switched setUp to setup)Christopher Allan Webber2013-04-038-10/+10
|/
* Changing "evil" submission test-script to be a bash script.Christopher Allan Webber2013-03-123-0/+0
|
* Fix deleting media with attachments.Elrond2013-02-181-0/+15
| | | | | | | | | | | | | | If one deletes a media with attachments, there have been various problems: 1) If the file in the storage did not exist any more (maybe because due to a previous deletion attempt?), the error propagation failed, because the wrong thing was gathered. 2) The attachment database entries were not deleted. Using cascade for this, for now. Also add a simple unit test, that tests both by having a broken attachment on a media.
* Some tests for media_data, yeah!Elrond2013-02-012-1/+25
| | | | | | | | 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.
* Better Py3 compat: d.has_key(k) -> k in dElrond2013-01-302-22/+11
| | | | | | | | py3 does not have dict.has_key any more. You have to use "key in dict" instead. As that works in python2 as well, let's use that. Also some small bits of pep8.
* Improve runtime of one test.Elrond2013-01-291-4/+10
| | | | Do not commit so often. flushing is enough.
* Failing testcase for issue 611.Elrond2013-01-292-2/+68
| | | | | | | | | | This currently fails (with foreign key constrain error): 1. Have user A and B. 2. User B creates media M. 3. User A post a comment on M. 4. User A deletes his own account. The test is a little bit wider.
* Fix reference of get_test_app->get_app in test_modelmethodsChristopher Allan Webber2013-01-251-2/+2
| | | | | (This changed in master while this test was being written; correcting post-merge.)
* Merge branch '216_cwebber_style_unique_slugs'Christopher Allan Webber2013-01-251-0/+130
|\
| * New mediaentry slug tests now pass!Christopher Allan Webber2013-01-231-0/+130
| | | | | | | | | | | | - fixed some issues with "whacking uuid junk on the slug" - uuid4() -> uuid.uuid4() so that mock will work right - added all the tests!
* | Restructure ForgotPassword viewSebastian Spaeth2013-01-211-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Remove mongo limitations (no 'or' when querying for either username or email). 2) Lost password function revealed if an user name or email address is registered, which can be considered a data leak. Leaking user names is OK, they are public anyway, but don't reveal lookup success in case the lookup happened by email address. Simply respond: "If you have an account here, we have send you your email"? 3) username and email search was case sensitive. Made username search case insensitive (they are always stored lowercase in the db). Keep email-address search case sensitive for now. This might need further discussion 4) Remove a whole bunch of indention in the style of: if no error: ... if no error: ... if no error: actually do something in the regular case by restructuring the function. 5) Outsource the sanity checking for username and email fields into the validator function. This way, we get automatic case sanity checking and sanitizing for all required fields. 6) Require 5-char password and fix tests Originally, the Change password form required a password between 6-30 chars while the registration and login form did not require anything special. This commit introduces a common minimum limit for all forms which breaks the test suite which uses a 5 char password by default. :-). As 5 chars seem sensible enough to enforce (people should be picking much longer ones anyway), just reduce the limit to 5 chars, thereby making all tests pass. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | 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!
* | Add some simple collection test.Elrond2013-01-182-1/+59
| |
* | Rename get_test_app to get_app.Elrond2013-01-1812-32/+32
| | | | | | | | | | | | | | 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.
* | Move workbench into tools directory.Elrond2013-01-171-1/+1
| |
* | Merge commit '9408938' from 565_workbench_cleanup (spaetz)Christopher Allan Webber2013-01-171-8/+26
|\ \
| * | Add @get_workbench testSebastian Spaeth2013-01-161-2/+19
| | | | | | | | | | | | | | | | | | Test the decorator function and proper cleanup after it's usage. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
| * | Shorten Workbench(Manager) method namesSebastian Spaeth2013-01-161-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) destroy_self() is a horrible function name, make it "destroy". workbench.destroy() is descriptive enough. 2) WorkbenchManager.create_workbench() -> WorkbenchManager.create() We use the pattern "with workbench_manager.create() as workbench:" No need to mention workbenches three times in a row... Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | | Introduce user_deletion test.Sebastian Spaeth2013-01-171-0/+18
|/ / | | | | | | | | | | | | | | Delete a user via web interface and see if it works. TODO: this does not test that related entries are also cleaned up and we should extend the test to do so. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | Merge remote-tracking branch 'refs/remotes/elrond/misc/use_media_id'Christopher Allan Webber2013-01-161-2/+8
|\ \ | |/ |/|
| * 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.
* | More explicit get_or_create patternSebastian Spaeth2013-01-151-1/+4
|/ | | | | | | | | Don't do "user = getUser() or newUser()" in one line. It is bound to confuse poor souls. Be more explicit here and even add a code comment. Thanks to Elrond for not liking the previous pattern. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Improve and extend profile editing testsSebastian Spaeth2013-01-091-76/+97
| | | | | | | | | | | | | | | | | | We only ever ran the password changing test here, and not the half-existing test for changing the bio and homepage. Fix the tests to actually run both tests. We check that setting bio and homepage to a valid value works as expected. We also test for invalid bio (too long) and invalid URLs setting fails. (which is what we want). - Check that the old /edit/profile/ address redirects to /u/USER/edit/. - Check that /u/USER/edit/ works as expected - Check that /u/OTHERUSER/edit/ fails with a 403 Forbidden error when we are not logged in as that user. The last remaining test that would be useful is to make a user an admin and make sure the admin can edit other users' profiles. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Fix tests on webtest < 1.3.6.Elrond2013-01-091-1/+5
| | | | | | | | | | | Debian testing ships webtest 1.3.4. And it would be nice to use the base packages. One of the csrf tests fails on webtest < 1.3.6. But using a fresh app fixes it. We have no clue, why exactly. When we require webtest 1.3.6, change this.