paste*: Remove some test warnings

This commit is contained in:
Laurent Bachelier 2012-11-09 12:53:11 +01:00 committed by Romain Bignon
commit 9773f9d626
2 changed files with 26 additions and 26 deletions

View file

@ -31,7 +31,7 @@ class PastealaconTest(BackendTest):
# html method # html method
p = self.backend.get_paste(_id) p = self.backend.get_paste(_id)
self.backend.fillobj(p, ['title']) self.backend.fillobj(p, ['title'])
assert p.title == 'ouiboube' assert p.title == u'ouiboube'
assert p.page_url.startswith('http://pastealacon.com/') assert p.page_url.startswith('http://pastealacon.com/')
assert u'héhéhé' in p.contents assert u'héhéhé' in p.contents
assert p.public is True assert p.public is True
@ -45,7 +45,7 @@ class PastealaconTest(BackendTest):
assert p.public is True assert p.public is True
def test_post(self): def test_post(self):
p = self.backend.new_paste(None, title='ouiboube', contents=u'Weboob Test héhéhé') p = self.backend.new_paste(None, title=u'ouiboube', contents=u'Weboob Test héhéhé')
self.backend.post_paste(p, max_age=3600*24) self.backend.post_paste(p, max_age=3600*24)
assert p.id assert p.id
self.backend.fill_paste(p, ['title']) self.backend.fill_paste(p, ['title'])
@ -60,7 +60,7 @@ class PastealaconTest(BackendTest):
self._get_paste('http://pastealacon.com/'+p.id) self._get_paste('http://pastealacon.com/'+p.id)
def test_spam(self): def test_spam(self):
p = self.backend.new_paste(None, title='viagra', contents='http://example.com/') p = self.backend.new_paste(None, title=u'viagra', contents=u'http://example.com/')
self.assertRaises(BrowserUnavailable, self.backend.post_paste, p) self.assertRaises(BrowserUnavailable, self.backend.post_paste, p)
def test_notfound(self): def test_notfound(self):
@ -81,13 +81,13 @@ class PastealaconTest(BackendTest):
assert self.backend.get_paste('nJG9ZFG8') is None assert self.backend.get_paste('nJG9ZFG8') is None
def test_can_post(self): def test_can_post(self):
assert 0 == self.backend.can_post('hello', public=False) assert 0 == self.backend.can_post(u'hello', public=False)
assert 1 <= self.backend.can_post('hello', public=True) assert 1 <= self.backend.can_post(u'hello', public=True)
assert 0 == self.backend.can_post('hello', public=True, max_age=600) assert 0 == self.backend.can_post(u'hello', public=True, max_age=600)
assert 1 <= self.backend.can_post('hello', public=True, max_age=3600*24) assert 1 <= self.backend.can_post(u'hello', public=True, max_age=3600*24)
assert 1 <= self.backend.can_post('hello', public=True, max_age=3600*24*3) assert 1 <= self.backend.can_post(u'hello', public=True, max_age=3600*24*3)
assert 1 <= self.backend.can_post('hello', public=True, max_age=False) assert 1 <= self.backend.can_post(u'hello', public=True, max_age=False)
assert 1 <= self.backend.can_post('hello', public=None, max_age=False) assert 1 <= self.backend.can_post(u'hello', public=None, max_age=False)
assert 1 <= self.backend.can_post('hello', public=True, max_age=3600*24*40) assert 1 <= self.backend.can_post(u'hello', public=True, max_age=3600*24*40)
assert 1 <= self.backend.can_post(u'héhé', public=True) assert 1 <= self.backend.can_post(u'héhé', public=True)
assert 0 == self.backend.can_post(u'hello ♥', public=True) assert 0 == self.backend.can_post(u'hello ♥', public=True)

View file

@ -29,9 +29,9 @@ class PastebinTest(BackendTest):
# html method # html method
p = self.backend.get_paste(_id) p = self.backend.get_paste(_id)
self.backend.fillobj(p, ['title']) self.backend.fillobj(p, ['title'])
assert p.title == 'plop' assert p.title == u'plop'
assert p.page_url == 'http://pastebin.com/7HmXwzyt' assert p.page_url == 'http://pastebin.com/7HmXwzyt'
assert p.contents == 'prout' assert p.contents == u'prout'
assert p.public is True assert p.public is True
# raw method # raw method
@ -39,21 +39,21 @@ class PastebinTest(BackendTest):
self.backend.fillobj(p, ['contents']) self.backend.fillobj(p, ['contents'])
assert p.title is NotLoaded assert p.title is NotLoaded
assert p.page_url == 'http://pastebin.com/7HmXwzyt' assert p.page_url == 'http://pastebin.com/7HmXwzyt'
assert p.contents == 'prout' assert p.contents == u'prout'
assert p.public is NotLoaded assert p.public is NotLoaded
def test_post(self): def test_post(self):
p = self.backend.new_paste(None, title='ouiboube', contents='Weboob Test', public=True) p = self.backend.new_paste(None, title=u'ouiboube', contents=u'Weboob Test', public=True)
self.backend.post_paste(p, max_age=600) self.backend.post_paste(p, max_age=600)
assert p.id assert p.id
self.backend.fill_paste(p, ['title']) self.backend.fill_paste(p, ['title'])
assert p.title == 'ouiboube' assert p.title == u'ouiboube'
assert p.id in p.page_url assert p.id in p.page_url
assert p.public is True assert p.public is True
def test_specialchars(self): def test_specialchars(self):
# post a paste and get the contents through the HTML response # post a paste and get the contents through the HTML response
p1 = self.backend.new_paste(None, title='ouiboube', contents=u'Weboob <test>¿¡', public=False) p1 = self.backend.new_paste(None, title=u'ouiboube', contents=u'Weboob <test>¿¡', public=False)
self.backend.post_paste(p1, max_age=600) self.backend.post_paste(p1, max_age=600)
assert p1.id assert p1.id
# not related to testing special chars, but check if the paste is # not related to testing special chars, but check if the paste is
@ -81,14 +81,14 @@ class PastebinTest(BackendTest):
assert self.backend.get_paste('http://pastealacon.com/1') is None assert self.backend.get_paste('http://pastealacon.com/1') is None
def test_can_post(self): def test_can_post(self):
assert self.backend.can_post('hello', public=None) > 0 assert self.backend.can_post(u'hello', public=None) > 0
assert self.backend.can_post('hello', public=True) > 0 assert self.backend.can_post(u'hello', public=True) > 0
assert self.backend.can_post('hello', public=False) > 0 assert self.backend.can_post(u'hello', public=False) > 0
assert self.backend.can_post('hello', public=True, max_age=600) > 0 assert self.backend.can_post(u'hello', public=True, max_age=600) > 0
assert self.backend.can_post('hello', public=True, max_age=3600*24) > 0 assert self.backend.can_post(u'hello', public=True, max_age=3600*24) > 0
assert self.backend.can_post('hello', public=True, max_age=3600*24*3) > 0 assert self.backend.can_post(u'hello', public=True, max_age=3600*24*3) > 0
assert self.backend.can_post('hello', public=True, max_age=False) > 0 assert self.backend.can_post(u'hello', public=True, max_age=False) > 0
assert self.backend.can_post('hello', public=None, max_age=False) > 0 assert self.backend.can_post(u'hello', public=None, max_age=False) > 0
assert self.backend.can_post('hello', public=True, max_age=3600*24*40) > 0 assert self.backend.can_post(u'hello', public=True, max_age=3600*24*40) > 0
assert self.backend.can_post(u'héhé', public=True) > 0 assert self.backend.can_post(u'héhé', public=True) > 0
assert self.backend.can_post(u'hello ♥', public=True) > 0 assert self.backend.can_post(u'hello ♥', public=True) > 0