aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/tools.py
Commit message (Collapse)AuthorAgeFilesLines
* Patch by Strum. Ticket #451 - Convert all mongokit style .find, .find_one, ↵Rodney Ewing2013-07-111-1/+1
| | | | .one calls over to SQLAlchemy queries
* Merge remote-tracking branch 'upstream/master' into authRodney Ewing2013-06-251-6/+89
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/app.py mediagoblin/auth/forms.py mediagoblin/auth/tools.py mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/edit/views.py mediagoblin/plugins/basic_auth/tools.py mediagoblin/tests/test_edit.py
| * Adding a docstring to fixture_media_entryChristopher Allan Webber2013-06-221-0/+8
| | | | | | | | | | | | | | It's not complete, but it makes clearer how to avoid errors with fake_upload :) This commit sponsored by Harper Sanford. Thank you!
| * New notificationsJoar Wandborg2013-06-091-6/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added request.notifications - Email configuration fixes - Set config_spec default SMTP port to `0` and switch to SSL/non-SSL default if `port == 0` - Added email_smtp_use_ssl configuration setting - Added migrations for notification tables - Added __repr__ to MediaComment(Mixin) - Added MediaComment.get_entry => MediaEntry - Added CommentSubscription, CommentNotification, Notification, ProcessingNotification tables - Added notifications.task to celery init - Fixed a bug in the video transcoder where pygst would hijack the --help argument. - Added notifications - views - silence - subscribe - routes - utility methods - celery task - Added half-hearted .active comment CSS style - Added quick JS to show header_dropdown - Added fragment template to show notifications in header_dropdown - Added fragment template to show subscribe/unsubscribe buttons on media/comment pages - Updated celery setup tests with notifications.task - Tried to fix test_misc tests that I broke - Added notification tests - Added and extended tests.tools fixtures - Integrated new notifications into media_home, media_post_comment views - Bumped SQLAlchemy dependency to >= 0.8.0 since we need polymorphic for the notifications to work
* | modified test .ini files and changed tests to use basic_auth bcryptRodney Ewing2013-05-241-2/+2
|/
* Moving test_user_dev->user_dev in plugin app configs & adding plugin static ↵Christopher Allan Webber2013-05-231-3/+2
| | | | | | | | | | | | | | | | serving The test_user_dev (as opposed to user_dev) was a legacy before we had each application running in its own directory (as they now do in pytest). Move that name to just user_dev... this is more consistent with the rest of our naming and will make writing these config files easier. (If we want to test that changing these still works, that should be a separate unit test with special config files.) Additionally, add plugin static serving to the common test paste config file. This commit sponsored by Juan Jose Marin Martinez. Thank you!
* Tests should no longer use the environment-variable-related-setup and set up ↵Christopher Allan Webber2013-05-121-28/+0
| | | | | | | | | in app instead This should remove a bunch of confusing cruft. I hate using that environment variable! Also that old code was fragile. This commit sponsored by Stephen Milton. Thanks!
* Merge remote-tracking branch 'joar-github/oauth/refresh_tokens'Nathan Yergler2013-04-131-3/+5
|\ | | | | | | This merges the patch for Issue #548.
| * OAuth: Support refresh tokens, etcJoar Wandborg2013-04-061-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 'brett/itsdangerous'Elrond2013-04-091-3/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | Remove beaker stuff from the code.Brett Smith2013-03-241-3/+1
| | | | | | | | | | | | This is all obsoleted by It's Dangerous.
* | | Really removing nosetests things now! all assert_whatever removedChristopher Allan Webber2013-04-061-2/+2
| |/ |/|
* | Switch test_app generation over to use py.test fixtures.Christopher Allan Webber2013-04-041-54/+25
| | | | | | | | | | | | | | | | | | | | | | | | 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
|/
* Failing testcase for issue 611.Elrond2013-01-291-1/+17
| | | | | | | | | | 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.
* Add some simple collection test.Elrond2013-01-181-1/+22
|
* 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.
* 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>
* Do not fail is a user exists alreadySebastian Spaeth2013-01-081-3/+4
| | | | | | | | | When the tests want to create a new user, don't fail if it already exists and just reuse the existing one. This allows us to run tests without dumping the whole database if that is not needed for the tests. The upcoming tests for test_edit will make use of this. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Mv db.sql.base to db.baseSebastian Spaeth2013-01-071-2/+1
| | | | | | | | This concludes the db.sql.* -> db.* move. Our db abstraction layer is sqlalchemy, so there is no need to a separate db.sql.* hierarchy. All tests have been run for each of the commit series to make sure everything works at every step.
* replace webob.Response with werkzeug ResponseSebastian Spaeth2012-12-211-1/+1
| | | | | | | | | | | | Replace webob usage in one more file. Document a TODO that should be clarified, we should probably be using json_response rather than Response() here. Modify the TestMeddleware to not rely on the content_type attribute being present, while werkzeug.wrappers Response() has it the BaseResponse() object which is often returned in tests does not have it. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Move DBModel._id -> DBModel.idSebastian Spaeth2012-12-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Fixed pylint/pep8 warnings in test/tools.pyJoar Wandborg2012-09-291-2/+2
|
* Added some OAuth plugin testsJoar Wandborg2012-09-261-2/+2
|
* Fixed testsJoar Wandborg2012-09-151-1/+1
| | | | | - Adapt tests to new global_config arg for run_dbupdate - Account for [plugins] not being set in config
* removed _make_safe in favor of functools.wrapsJakob Kramer2012-07-121-3/+6
|
* Drop our scoped session sooner to prevent SQLAlchemy re-binding warnings.Brett Smith2012-07-081-3/+3
|
* Reload and detach the test user.Elrond2012-03-261-0/+7
| | | | | | | | The code often needs to know some fields of the test user even after doing some sql and stuff. The solultion is to reload it and properly detach it from its Session. That way all its fields are available and the whole thing is not connected to a session. It feels like a normal object.
* SQL based tests and refactored Celery setup stuffChristopher Allan Webber2012-03-261-15/+11
| | | | | | - Changed config files of test configs to use SQL - Updated celery initialization tools, factored them to be able to use the "big instance" application stuff
* It's 2012 all up in hereChristopher Allan Webber2012-02-021-1/+1
|
* fixture_add_user: Factoring a unit test toolElrond2011-12-011-0/+17
| | | | | | | 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.
* Add base class for MeddlewareElrond2011-11-251-7/+2
| | | | | | | | | | Created a BaseMeddleware which all Meddleware should derive from. This is not strictly needed, but will greatly help. The base class has the common __init__ of all the other Meddlwares and fall backs for all hooks. That way a new Meddlware only needs to override what it actually wants to implement.
* Rename MediaGoblin middleware to meddleware to avoid confusion w/ wsgi ↵Christopher Allan Webber2011-11-251-5/+5
| | | | | | middleware hehehehehe, "meddleware"
* Move TestingMiddleware to tests/tools.pyElrond2011-11-121-1/+45
| | | | | This middleware isn't needed outside of the tests, so let's just put it there.
* Some docs for the TestingMiddlewareElrond2011-11-121-0/+2
| | | | | To make the TestingMiddleware actually more useful in the future, start to document it.
* 591: Let Testing Middleware check for staticdirect() usageElrond2011-10-191-0/+6
| | | | | | | | | All references to static, shipped content should go via request.staticdirect(). So insert a TestingMiddleware in the chain, which tests for this on all requests/reponses happening in the test suite. It's a simple text search for a bogus usage pattern.
* Finished splitting util.py into separate files.Aaron Williamson2011-10-011-3/+3
|
* 508. Updates copyright/license informationWill Kahn-Greene2011-09-011-1/+1
|
* get_test_app() should turn on testing bucketsChristopher Allan Webber2011-08-011-0/+3
|
* testing tools install_fixtures_simple and assert_db_meets_expectedChristopher Allan Webber2011-07-101-0/+32
| | | | Thought I installed these... guess I didn't!
* Move config.py to init/Elrond2011-07-021-1/+1
| | | | | | | Some simple changes needed to do that. The interesting question left: Should config_spec.ini also be moved?
* Move mediagoblin.celery_setup -> mediagoblin.init.celeryElrond2011-07-021-4/+4
| | | | | | As the first target of the new .init. submodule move celery_setup there. Quite straight forward, just a lot of places to change.
* Celery wasn't really being properly connected during tests.Christopher Allan Webber2011-06-261-11/+4
| | | | | | | | | | | | | | | Lots of fixes to do this. - setup_celery_from_config no longer responsible for checking 'celery_setup_elsewhere'; that's the app's job. (This was a problem because more than the app was relying on using this function) - Allow us to specifically set the config file we're setting up celery from with setup_self - Set up celery_always_eager. This is something we strongly want while doing tests. - Instead of setting up the app in the get_test_app method, let's set that up simply by importing from_tests, which should itself up via from_celery being the environment variable being set.
* Extra checks so that we don't even RUN tests unless the right celery environ setChristopher Allan Webber2011-06-211-5/+11
|
* Make sure we *ONLY* ever kill the test database, EVER.Christopher Allan Webber2011-06-211-5/+2
|
* Also moving the test_server.ini to test_paste.ini to avoid ambiguity.Christopher Allan Webber2011-06-201-1/+1
|
* Need to run nosetests with CELERY_CONFIG_MODULE set to from_tests again.Christopher Allan Webber2011-06-191-3/+5
| | | | | Basically, if we don't do this celery sets itself up before it should and improperly. :\
* Nosetests should now be able to run using the new configobj / app init setupChristopher Allan Webber2011-06-181-16/+29
| | | | | | | | | Lots of changes: - CELERY_CONFIG_FILE does not need to be set to the from_tests module to run tests anymore, in fact it *should not be set at all* and is specifically forbidden. - moved around the configuration to the new 2-file format - and generally adjusting the code appropriately.