Merge branch 'pre-auth' into basic_auth
[mediagoblin.git] / mediagoblin / tools / testing.py
1 # GNU MediaGoblin -- federated, autonomous media hosting
2 # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 from mediagoblin.tools import common
18 from mediagoblin.tools.template import clear_test_template_context
19 from mediagoblin.tools.mail import EMAIL_TEST_INBOX, EMAIL_TEST_MBOX_INBOX
20
21 def _activate_testing():
22 """
23 Call this to activate testing in util.py
24 """
25
26 common.TESTS_ENABLED = True
27
28 def clear_test_buckets():
29 """
30 We store some things for testing purposes that should be cleared
31 when we want a "clean slate" of information for our next round of
32 tests. Call this function to wipe all that stuff clean.
33
34 Also wipes out some other things we might redefine during testing,
35 like the jinja envs.
36 """
37 global SETUP_JINJA_ENVS
38 SETUP_JINJA_ENVS = {}
39
40 global EMAIL_TEST_INBOX
41 global EMAIL_TEST_MBOX_INBOX
42 EMAIL_TEST_INBOX = []
43 EMAIL_TEST_MBOX_INBOX = []
44
45 clear_test_template_context()