pastealacon backend: Support posting

The captcha is not handled but an exception is properly raised.
This commit is contained in:
Laurent Bachelier 2011-04-14 00:36:48 +02:00 committed by Romain Bignon
commit 4dc3e56d18
4 changed files with 47 additions and 4 deletions

View file

@ -19,6 +19,8 @@
from weboob.tools.test import BackendTest
from weboob.capabilities.base import NotLoaded
from weboob.tools.browser import BrowserUnavailable
from .paste import PastealaconPaste
class PastealaconTest(BackendTest):
BACKEND = 'pastealacon'
@ -37,3 +39,14 @@ class PastealaconTest(BackendTest):
assert p.title is NotLoaded
assert p.page_url == 'http://pastealacon.com/27184'
assert u'coucou\r\ncoucou\r\nhéhéhé' == p.contents
def test_post(self):
p = PastealaconPaste(None, title='ouiboube', contents='Weboob Test')
self.backend.post_paste(p)
assert p.id
assert p.title == 'ouiboube'
assert p.id in p.page_url
def test_spam(self):
p = PastealaconPaste(None, title='viagra', contents='http://example.com/')
self.assertRaises(BrowserUnavailable, self.backend.post_paste, p)