aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2012-09-27 00:45:25 +0200
committerJoar Wandborg <git@wandborg.com>2012-09-27 00:45:25 +0200
commit0df00eb68fae5e75858265ba6fce9cff40934482 (patch)
treeab5315b42b0f5c5af9a7a19dde468fea7bdb5968 /mediagoblin/tools
parenta11aa2d17a32affeba61a54bda0e3b424275f238 (diff)
downloadmediagoblin-0df00eb68fae5e75858265ba6fce9cff40934482.tar.lz
mediagoblin-0df00eb68fae5e75858265ba6fce9cff40934482.tar.xz
mediagoblin-0df00eb68fae5e75858265ba6fce9cff40934482.zip
Added tests for HTTP callbacks
Diffstat (limited to 'mediagoblin/tools')
-rw-r--r--mediagoblin/tools/processing.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mediagoblin/tools/processing.py b/mediagoblin/tools/processing.py
index 5840c7e0..cff4cb9d 100644
--- a/mediagoblin/tools/processing.py
+++ b/mediagoblin/tools/processing.py
@@ -21,8 +21,12 @@ import traceback
from urllib2 import urlopen, Request, HTTPError
from urllib import urlencode
+from mediagoblin.tools.common import TESTS_ENABLED
+
_log = logging.getLogger(__name__)
+TESTS_CALLBACKS = {}
+
def create_post_request(url, data, **kw):
'''
@@ -62,6 +66,11 @@ def json_processing_callback(entry):
'id': entry.id,
'state': entry.state}
+ # Trigger testing mode, no callback will be sent
+ if url.endswith('secrettestmediagoblinparam'):
+ TESTS_CALLBACKS.update({url: data})
+ return True
+
request = create_post_request(
url,
data,