Skip to content
Browse files

avoid grinder hitting bitly to share links and replace tabs with spaces

  • Loading branch information...
1 parent 57f10f0 commit f3180c9b6a486d70db0c2deaf550904306f8ac91 @mhammond mhammond committed Mar 9, 2011
Showing with 16 additions and 12 deletions.
  1. +6 −1 grinder.ini
  2. +10 −11 grinder/send.py
View
7 grinder.ini
@@ -9,7 +9,12 @@ debug = true
#email_to = you@yourdomain.com
smtp_server = localhost
error_email_from = paste@localhost
-test_shortener = yes
+
+# there is no test shortener any more :( But DO NOT
+# use the production bitly id and key or we will hit the bitly rate-limiter
+# which will impact production!!
+bitly.userid = ???
+bitly.key = ???
# We specify our local test server is used for all service connections.
stub_service_server=127.0.0.1:8327
View
21 grinder/send.py
@@ -122,8 +122,10 @@ def send(userid, csrf, domain=linkdrop_service, message="take that!"):
( NVPair('domain', domain),
NVPair('userid', userid),
NVPair('csrftoken', csrf),
- NVPair('shorten', 'true'),
- NVPair('link', "http://www.google.com/%s" % grinder.getRunNumber() ),
+ # NOTE: no 'link' as we don't want to hit bitly in these tests
+ # (and if we ever decide we do, we must not use the bitly production
+ # userid and key!)
+ # NVPair('link', "http://www.google.com/%s" % grinder.getRunNumber() ),
NVPair('message', message), ),
( NVPair('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'), ))
assert result.getStatusCode()==200, result
@@ -133,9 +135,9 @@ def send(userid, csrf, domain=linkdrop_service, message="take that!"):
send = Test(4, "Send message").wrap(send)
def getStatic(url="/share/"):
- result = request1.GET(linkdrop_host + url)
- assert result.getStatusCode()==200, result
- return result
+ result = request1.GET(linkdrop_host + url)
+ assert result.getStatusCode()==200, result
+ return result
getStatic = Test(5, "Static request").wrap(getStatic)
@@ -148,9 +150,9 @@ def __init__(self):
self.userid = None
def doit(self):
- if linkdrop_static_per_send:
- for i in range(0,linkdrop_static_per_send):
- getStatic(linkdrop_static_url)
+ if linkdrop_static_per_send:
+ for i in range(0,linkdrop_static_per_send):
+ getStatic(linkdrop_static_url)
if self.csrf is None or \
(sends_per_oauth and grinder.getRunNumber() % sends_per_oauth==0):
self.csrf, self.linkdrop_cookie = getCSRF()
@@ -167,6 +169,3 @@ def doit(self):
def __call__(self):
"""This method is called for every run performed by the worker thread."""
TestRunner.doit(self)
-
-
-

0 comments on commit f3180c9

Please sign in to comment.
Something went wrong with that request. Please try again.