[#6896] Update test example; comment merge instructions
Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>
diff --git a/Allura/docs/contributing.rst b/Allura/docs/contributing.rst
index e6ed088..ac956eb 100644
--- a/Allura/docs/contributing.rst
+++ b/Allura/docs/contributing.rst
@@ -193,13 +193,16 @@
tests that cover behaviour that you've added or changed. You may find this
:doc:`short guide <tutorials/testing>` helpful.
-Submitting a Merge Request
---------------------------
-Before submitting a merge request, make sure your changes conform to our
-`contribution guidelines <https://forge-allura.apache.org/p/allura/wiki/Contributing%20Code/>`_.
-Once your changes are finished and tested, submit them to be merged back into
-the main repo:
+.. Commenting out merge request instructions until we have forking working
+ on forge-allura.apache.org
-* Fork the main Allura repo from here: https://forge-allura.apache.org/p/allura/git/ci/master/tree/
-* Commit and push your changes to your fork
-* Submit a Merge Request from your fork
+ Submitting a Merge Request
+ --------------------------
+ Before submitting a merge request, make sure your changes conform to our
+ `contribution guidelines <https://forge-allura.apache.org/p/allura/wiki/Contributing%20Code/>`_.
+ Once your changes are finished and tested, submit them to be merged back into
+ the main repo:
+
+ * Fork the main Allura repo from here: https://forge-allura.apache.org/p/allura/git/ci/master/tree/
+ * Commit and push your changes to your fork
+ * Submit a Merge Request from your fork
diff --git a/Allura/docs/tutorials/testing.rst b/Allura/docs/tutorials/testing.rst
index b1164a5..7c46a62 100644
--- a/Allura/docs/tutorials/testing.rst
+++ b/Allura/docs/tutorials/testing.rst
@@ -49,21 +49,23 @@
provided by the `WebTest <http://pythonpaste.org/webtest/>`_ module, where you can
find further documentation for the `.get()` and `.post()` methods.
-Testing Allura models is also straightforward, though it usually requires
-setting the pylons context object `c` before your test. An example of this
-technique follows::
+Testing Allura models is also straightforward, though you will often
+need to setup pylons global objects before your test. If the code under test
+uses pylons globals (like `g` and `c`), but your test doesn't require the
+fully-loaded wsgi app, you can do something like this::
- import mock
- from pylons import tmpl_context as c, app_globals as g
+ from pylons import tmpl_context as c
- from allura.lib.app_globals import Globals
+ from alluratest.controller import setup_unit_test
+ from allura.lib import helpers a h
from allura import model as M
def setUp():
- g._push_object(Globals())
- c._push_object(mock.Mock())
- g.set_project('projects/test')
- g.set_app('hello')
+ # set up pylons globals
+ setup_unit_test()
+
+ # set c.project and c.app
+ h.set_context('test', 'wiki', neighborhood='Projects'):
c.user = M.User.query.get(username='test-admin')
Testing the tasks and events is similar to testing models. Generally, you will