[tor-commits] [bridgedb/master] Add coverage skip lines to untestable portion of ReCaptcha.get().
isis at torproject.org
isis at torproject.org
Sun Mar 16 19:04:58 UTC 2014
commit b9c88a7737dda87887b4364bcb778c3d35a8e3a3
Author: Isis Lovecruft <isis at torproject.org>
Date: Tue Mar 11 21:05:49 2014 +0000
Add coverage skip lines to untestable portion of ReCaptcha.get().
---
lib/bridgedb/captcha.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/captcha.py b/lib/bridgedb/captcha.py
index b4b0485..e508d21 100644
--- a/lib/bridgedb/captcha.py
+++ b/lib/bridgedb/captcha.py
@@ -126,10 +126,13 @@ class ReCaptcha(Captcha):
# Extract and store image from recaptcha
html = urllib2.urlopen(urlbase + form).read()
- soup = BeautifulSoup(html)
- imgurl = urlbase + "/" + soup.find('img')['src']
- self.challenge = str(soup.find('input', {'name': 'recaptcha_challenge_field'})['value'])
- self.image = urllib2.urlopen(imgurl).read()
+ # FIXME: The remaining lines currently cannot be reliably unit tested:
+ soup = BeautifulSoup(html) # pragma: no cover
+ imgurl = urlbase + "/" + soup.find('img')['src'] # pragma: no cover
+ cField = soup.find( # pragma: no cover
+ 'input', {'name': 'recaptcha_challenge_field'}) # pragma: no cover
+ self.challenge = str(cField['value']) # pragma: no cover
+ self.image = urllib2.urlopen(imgurl).read() # pragma: no cover
class GimpCaptcha(Captcha):
More information about the tor-commits
mailing list