407 Commits

Author SHA1 Message Date
Christopher Allan Webber
23055eb394 Full unit test for the plugin assetlink command.
Tests:
 - if the link doesn't exist yet
 - if the link already exists
 - if it is a symlink to something else
 - if it exists but is not a symlink

This commit sponsored by Lon Koenig.  Thank you!
2013-05-23 13:33:08 -05:00
Christopher Allan Webber
bdd23c0eae test_plugin_staticdirect now works and passes.
This commit sponsored by Samuel Vale.  Thank you!
2013-05-23 13:33:08 -05:00
Christopher Allan Webber
1b2cf1e823 Simple "staticstuff" plugin for writing unit tests on plugin static asset linking.
It doesn't do much... it just has a static directory with a "bunnify"
CSS file and has a unit test that returns a json encoded set of a
staticdirect with both this plugin enabled and also
with (theoretically) a file distributed with MediaGoblin (it isn't
really, but in our case that doesn't matter.)

Also set up the static_setup hook / PluginStatic object for this
plugin; testing that with `./bin/gmg theme assetlink` seemed to work.
(And argh, need to update that command name, I know.)

This commit sponsored by Bradley Kuhn.  Thanks bkuhn!
2013-05-23 13:33:07 -05:00
Christopher Allan Webber
491029bc36 Moving test_user_dev->user_dev in plugin app configs & adding plugin static 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!
2013-05-23 13:33:07 -05:00
Rodney Ewing
eb396abc4a modified change_pass tests 2013-05-20 14:28:43 -07:00
Elrond
4adc3a85dd piwigo: Return proper error for wrong user/password.
And fix tests.
2013-05-20 19:36:28 +02:00
Elrond
d6c3375a78 A bit of pep8 and small typo fix. 2013-05-20 19:35:16 +02:00
Joar Wandborg
c5323f29f3 Fixed EXIF tests 2013-05-20 00:11:00 +02:00
Christopher Allan Webber
b69dd85304 Merge remote-tracking branch 'refs/remotes/elrond/misc/pytest_enable_testing' 2013-05-17 11:13:17 -05:00
Christopher Allan Webber
9a9bafc078 Reverting "Always activate testing in every test module ever."
Revert "Always activate testing in every test module ever."

This reverts commit 0536306048daa0970d2e43411ba2a9bf073e570e.
2013-05-17 11:12:56 -05:00
Elrond
5fa843f31f Always activate testing using pytest fixture.
This is possibly the cleaner approach to the problem solved
in the previous commit.

The previous commit makes sure, that testing is enabled at
import time. While this one enables it just before the
individual test is run. So this one takes a bit more CPU.

Maybe revert the previous commit?

References: 0536306048daa0970d2e43411ba2a9bf073e570e
2013-05-17 01:46:20 +02:00
Christopher Allan Webber
0536306048 Always activate testing in every test module ever.
Kind of a dorky way to implement this, but...
2013-05-16 17:51:21 -05:00
Christopher Allan Webber
ff97bbe944 Merge branch '623_context_hooks' 2013-05-15 11:40:51 -05:00
Christopher Allan Webber
a1099bba79 Testing the template_context_prerender hook
This allows for modifying any context *right before render*, including
access to the variables that are passed in.  This test takes advantage
of that and takes one of the variables, "doubleme", and modifies
it (doubles it!)

In our case it turns "happy" and "joy" into "happyhappy" and "joyjoy".

This commit sponsored by Mark Holmquist.  Thank you!
2013-05-15 11:40:28 -05:00
Christopher Allan Webber
5046ca2433 Documenting the test_modify_context and context_modified_app methods 2013-05-14 14:29:23 -05:00
Christopher Allan Webber
f7a5c7c78c Fully working context hooks, both template/view and global level, with tests
Needs documentation though... that's coming next :)

This commit sponsored by Luca Tius.  Thanks Luca!
2013-05-14 14:24:27 -05:00
Elrond
76f0fb8cca piwigo: Start first tests.
This first test checks the session logic of the piwigo
plugin. login, logout, getStatus.
2013-05-12 23:19:58 +02:00
Christopher Allan Webber
725404236e Merge branch 'master' into 623_context_hooks 2013-05-12 16:17:35 -05:00
Christopher Allan Webber
2dee97ef48 Removing reference to nose (thanks for catching, Elrond!)
This commit sponsored by Kevin McCarthy.  Thank you!
2013-05-12 16:07:28 -05:00
Christopher Allan Webber
a98c95b41d Tests should no longer use the environment-variable-related-setup and set up 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!
2013-05-12 15:55:59 -05:00
Christopher Allan Webber
aac428bac2 Merge remote-tracking branch 'gabithume/146_debug_message' 2013-05-11 10:19:31 -05:00
Christopher Allan Webber
829f5f9371 Ah right, and here's the config we intend to use for these context modified tests :)
This commit sponsored by Xavier Gulliot.  Thanks Xavier!
2013-05-08 14:38:13 -05:00
Christopher Allan Webber
3810309443 The beginning of context hooks.
Not the working solution, but getting there conceptually.  Basically
we'll have a key with the view and the template as a tuple which is
the context hook that anyone can attach to.

However, some changes have still to be made:
 - The unit test doesn't work yet and contains a set_trace ;)
 - We'll probably switch the "view" component from being the callable
   to the "urlgen"'able name per Elrond's suggestion
 - Found a bug in unit tests related to running custom apps for
   different configs... hm.  I need to fix this!

Nonetheless, making progress.

This commit sponsored by... wait a minute... Christopher Webber?!
2013-05-08 14:35:31 -05:00
Christopher Allan Webber
d3604e2920 Unit tests for plugins defining their own config_spec.ini!
This commit sponsored by David Ahmed.  Thank you!
2013-05-08 11:02:53 -05:00
Gabi Thume
98ce23d204 Fixing ticket #146 - Make messaging system testable 2013-04-29 20:35:22 -07:00
Elrond
3b359dddc7 image resizing: Refactor some decisions into resize_tool.
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.
2013-04-27 17:19:50 +02:00
Elrond
d891966424 Unit test for ReallyLazyProxy.
LazyProxy caches its value. So create a unit test for
lazy_pass_to_ugettext to make sure its returned proxy
actually gives a different translation when the locale
is switched.
2013-04-25 14:31:29 +02:00
Elrond
fd1202b774 Cleanup storage after test, and test .delete_dir().
The storage tests work in the system's tmpdir. The python
docs say, we should clean up after using things.  Yes the
directory should be cleaned up on reboot, but if running
tests a lot, the tmpdir could fill up, so we should really
cleanup.

So use the new .delete_dir() on the storage interface to
cleanup test dirs and get them finally removed with
os.rmdir. All nicely packed into cleanup_storage().
2013-04-21 19:26:57 +02:00
Elrond
12dccc4552 Refactor test configs.
All the hook_* tests use the same config, so refactor it.
2013-04-20 00:24:09 +02:00
Christopher Allan Webber
97e0a79f39 Let's not use reserved keywords :) 2013-04-19 16:31:23 -05:00
Christopher Allan Webber
a0e7699a45 Added new tests to test hook_transform() 2013-04-19 16:28:41 -05:00
Christopher Allan Webber
d1146101bb Adjusting tests to use hook_handle and hook_runall 2013-04-19 16:16:26 -05:00
Christopher Allan Webber
2455a54f72 Moving the rest of the relevant tests to have test_app set up in "def setup()" as well 2013-04-18 11:15:47 -05:00
Christopher Allan Webber
0f3467013f at pytest author's advice, changing the way _setup back to -> setup
They showed me how to use @pytest.fixture, which allowed us to pass the
test into setup!
2013-04-18 10:53:36 -05:00
Elrond
f84425c0c1 Turning image's media manager into a new style class.
images are the first media type to use the new style class
based media manager.
2013-04-17 12:09:30 +02:00
Elrond
2077d6ed93 First step towards a MediaManager class: Compat one.
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.
2013-04-17 12:08:52 +02:00
Alon Levy
d0e9f843e2 PIL: Support systems with Pillow and without
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>
2013-04-17 12:54:54 +03:00
Elrond
b698c94d03 Refactor test resources into new resources.py 2013-04-17 01:15:46 +02:00
Elrond
54b3113abc PDF: Use pytest.mark.skipif for skipping tests
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.
2013-04-16 23:39:01 +02:00
Elrond
d38e9779dd test_timesince() doesn't need a complete test_app. 2013-04-16 19:40:57 +02:00
Christopher Allan Webber
455f2d6506 Removing unused imports 2013-04-15 15:55:24 -05:00
Alon Levy
a80ebf3b64 add pdf media type
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>
2013-04-15 09:51:21 +03:00
Nathan Yergler
64598a79a9 Merge remote-tracking branch 'joar-github/oauth/refresh_tokens'
This merges the patch for Issue #548.
2013-04-13 15:54:58 -07:00
Christopher Allan Webber
6432755db3 Merge remote-tracking branch 'refs/remotes/tsyesika/394-fuzzy-timestamp' 2013-04-13 11:42:34 -05:00
Jessica T
79e2d4eee4 Adds the unit tests and removes useless function we don't use 2013-04-12 01:40:15 +01:00
Christopher Allan Webber
761e26bb29 Merge branch '637_friendlier_hooks' 2013-04-10 17:53:05 -05:00
Christopher Allan Webber
cdc821eb74 callable hook convenience functions.. now work, and with tests!
- Added three "callables" test plugins.
 - updated callable_runone to check for unhandled_okay in the kwargs
   dict.

All passing!
2013-04-10 17:36:21 -05:00
Elrond
82a40cc4e1 Remove the last traces of beaker.
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.
2013-04-09 22:39:04 +02:00
Elrond
8021cc5605 Merge remote-tracking branch 'brett/itsdangerous'
* 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
2013-04-09 19:40:54 +02:00
Christopher Allan Webber
70c061955c tests for new pluginapi methods that can't possibly pass yet :) 2013-04-09 11:21:31 -05:00