Moving test_user_dev->user_dev in plugin app configs & adding plugin static serving
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 22 May 2013 17:23:06 +0000 (12:23 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 23 May 2013 18:33:07 +0000 (13:33 -0500)
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!

mediagoblin/tests/__init__.py
mediagoblin/tests/appconfig_context_modified.ini
mediagoblin/tests/test_mgoblin_app.ini
mediagoblin/tests/test_paste.ini
mediagoblin/tests/tools.py

index 7a88281e05ebb1c741c28d41d66cbff4f1dee2ea..cf2007915ab59284f86408456ca8c771b6079426 100644 (file)
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import os
-import shutil
-
-from mediagoblin import mg_globals
-from mediagoblin.tests.tools import TEST_USER_DEV
-
 
 def setup_package():
 
     import warnings
     from sqlalchemy.exc import SAWarning
     warnings.simplefilter("error", SAWarning)
-
-
-def teardown_package():
-    # Remove and reinstall user_dev directories
-    if os.path.exists(TEST_USER_DEV):
-        shutil.rmtree(TEST_USER_DEV)
index e93797df3b9f31b192e7fb7156a7dc9cd75eebac..80ca69b11c752bd8bbaa2ecd3aa72203f20b589c 100644 (file)
@@ -4,23 +4,23 @@ email_sender_address = "notice@mediagoblin.example.org"
 email_debug_mode = true
 
 # TODO: Switch to using an in-memory database
-sql_engine = "sqlite:///%(here)s/test_user_dev/mediagoblin.db"
+sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db"
 
 # Celery shouldn't be set up by the application as it's setup via
 # mediagoblin.init.celery.from_celery
 celery_setup_elsewhere = true
 
 [storage:publicstore]
-base_dir = %(here)s/test_user_dev/media/public
+base_dir = %(here)s/user_dev/media/public
 base_url = /mgoblin_media/
 
 [storage:queuestore]
-base_dir = %(here)s/test_user_dev/media/queue
+base_dir = %(here)s/user_dev/media/queue
 
 [celery]
 CELERY_ALWAYS_EAGER = true
-CELERY_RESULT_DBURI = "sqlite:///%(here)s/test_user_dev/celery.db"
-BROKER_HOST = "sqlite:///%(here)s/test_user_dev/kombu.db"
+CELERY_RESULT_DBURI = "sqlite:///%(here)s/user_dev/celery.db"
+BROKER_HOST = "sqlite:///%(here)s/user_dev/kombu.db"
 
 [plugins]
 [[mediagoblin.tests.testplugins.modify_context]]
index 2e876812147658e665e899a0ffa9f29a4fa77d3a..0466b53b901d60c77e0a0ebc2c5a0f17a19a8749 100644 (file)
@@ -4,7 +4,7 @@ email_sender_address = "notice@mediagoblin.example.org"
 email_debug_mode = true
 
 # TODO: Switch to using an in-memory database
-sql_engine = "sqlite:///%(here)s/test_user_dev/mediagoblin.db"
+sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db"
 
 # tag parsing
 tags_max_length = 50
@@ -15,16 +15,16 @@ allow_attachments = True
 media_types = mediagoblin.media_types.image, mediagoblin.media_types.pdf
 
 [storage:publicstore]
-base_dir = %(here)s/test_user_dev/media/public
+base_dir = %(here)s/user_dev/media/public
 base_url = /mgoblin_media/
 
 [storage:queuestore]
-base_dir = %(here)s/test_user_dev/media/queue
+base_dir = %(here)s/user_dev/media/queue
 
 [celery]
 CELERY_ALWAYS_EAGER = true
-CELERY_RESULT_DBURI = "sqlite:///%(here)s/test_user_dev/celery.db"
-BROKER_HOST = "sqlite:///%(here)s/test_user_dev/kombu.db"
+CELERY_RESULT_DBURI = "sqlite:///%(here)s/user_dev/celery.db"
+BROKER_HOST = "sqlite:///%(here)s/user_dev/kombu.db"
 
 [plugins]
 [[mediagoblin.plugins.api]]
index 91ecbb843193101ae455cd503bd9b798b74ad4c5..a95954325d7009cf11526fb8655613304f84bd58 100644 (file)
@@ -6,6 +6,8 @@ use = egg:Paste#urlmap
 / = mediagoblin
 /mgoblin_media/ = publicstore_serve
 /test_static/ = mediagoblin_static
+/theme_static/ = theme_static
+/plugin_static/ = plugin_static
 
 [app:mediagoblin]
 use = egg:mediagoblin#app
@@ -13,12 +15,22 @@ config = %(here)s/mediagoblin.ini
 
 [app:publicstore_serve]
 use = egg:Paste#static
-document_root = %(here)s/test_user_dev/media/public
+document_root = %(here)s/user_dev/media/public
 
 [app:mediagoblin_static]
 use = egg:Paste#static
 document_root = %(here)s/mediagoblin/static/
 
+[app:theme_static]
+use = egg:Paste#static
+document_root = %(here)s/user_dev/theme_static/
+cache_max_age = 86400
+
+[app:plugin_static]
+use = egg:Paste#static
+document_root = %(here)s/user_dev/plugin_static/
+cache_max_age = 86400
+
 [celery]
 CELERY_ALWAYS_EAGER = true
 
index 794ed940a98bc2b8dad69d11f6c8b607eee20012..2ee39e89c00c57f5f534972d0b4dec86b98f5df2 100644 (file)
@@ -40,8 +40,6 @@ TEST_SERVER_CONFIG = pkg_resources.resource_filename(
     'mediagoblin.tests', 'test_paste.ini')
 TEST_APP_CONFIG = pkg_resources.resource_filename(
     'mediagoblin.tests', 'test_mgoblin_app.ini')
-TEST_USER_DEV = pkg_resources.resource_filename(
-    'mediagoblin.tests', 'test_user_dev')
 
 
 USER_DEV_DIRECTORIES_TO_SETUP = ['media/public', 'media/queue']
@@ -103,7 +101,7 @@ def get_app(request, paste_config=None, mgoblin_config=None):
     # This is the directory we're copying the paste/mgoblin config stuff into
     run_dir = request.config._tmpdirhandler.mktemp(
         'mgoblin_app', numbered=True)
-    user_dev_dir = run_dir.mkdir('test_user_dev').strpath
+    user_dev_dir = run_dir.mkdir('user_dev').strpath
 
     new_paste_config = run_dir.join('paste.ini').strpath
     new_mgoblin_config = run_dir.join('mediagoblin.ini').strpath
@@ -232,3 +230,4 @@ def fixture_add_collection(name=u"My first Collection", user=None):
     Session.expunge(coll)
 
     return coll
+