CapPaste: add method to find if a paste is suitable for the backend

Basic support in pastoob added (there is no way yet to change the
default options).
Backends support the "public/private" requirement.
This commit is contained in:
Laurent Bachelier 2011-04-27 00:41:50 +02:00
commit fbd4511ffa
6 changed files with 50 additions and 3 deletions

View file

@ -43,6 +43,11 @@ class PastealaconBackend(BaseBackend, ICapPaste):
def new_paste(self, *args, **kwargs):
return PastealaconPaste(*args, **kwargs)
def can_post(self, public=None):
if public is False:
return 0
return 1
def get_paste(self, _id):
with self.browser:
return self.browser.get_paste(_id)

View file

@ -79,3 +79,7 @@ class PastealaconTest(BackendTest):
# same even with correct domain (IDs are numeric)
assert self.backend.get_paste('http://pastealacon.com/nJG9ZFG8') is None
assert self.backend.get_paste('nJG9ZFG8') is None
def test_can_post(self):
assert 0 == self.backend.can_post(public=False)
assert 1 == self.backend.can_post(public=True)