From 9773f9d626cd02d7f47d655c07a844d4f81434a8 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Fri, 9 Nov 2012 12:53:11 +0100 Subject: [PATCH] paste*: Remove some test warnings --- modules/pastealacon/test.py | 22 +++++++++++----------- modules/pastebin/test.py | 30 +++++++++++++++--------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/modules/pastealacon/test.py b/modules/pastealacon/test.py index a99e5a48..0624b299 100644 --- a/modules/pastealacon/test.py +++ b/modules/pastealacon/test.py @@ -31,7 +31,7 @@ class PastealaconTest(BackendTest): # html method p = self.backend.get_paste(_id) self.backend.fillobj(p, ['title']) - assert p.title == 'ouiboube' + assert p.title == u'ouiboube' assert p.page_url.startswith('http://pastealacon.com/') assert u'héhéhé' in p.contents assert p.public is True @@ -45,7 +45,7 @@ class PastealaconTest(BackendTest): assert p.public is True 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) assert p.id self.backend.fill_paste(p, ['title']) @@ -60,7 +60,7 @@ class PastealaconTest(BackendTest): self._get_paste('http://pastealacon.com/'+p.id) 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) def test_notfound(self): @@ -81,13 +81,13 @@ class PastealaconTest(BackendTest): assert self.backend.get_paste('nJG9ZFG8') is None def test_can_post(self): - assert 0 == self.backend.can_post('hello', public=False) - assert 1 <= self.backend.can_post('hello', public=True) - assert 0 == self.backend.can_post('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('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('hello', public=None, max_age=False) - assert 1 <= self.backend.can_post('hello', public=True, max_age=3600*24*40) + assert 0 == self.backend.can_post(u'hello', public=False) + assert 1 <= self.backend.can_post(u'hello', public=True) + assert 0 == self.backend.can_post(u'hello', public=True, max_age=600) + assert 1 <= self.backend.can_post(u'hello', public=True, max_age=3600*24) + assert 1 <= self.backend.can_post(u'hello', public=True, max_age=3600*24*3) + assert 1 <= self.backend.can_post(u'hello', public=True, max_age=False) + assert 1 <= self.backend.can_post(u'hello', public=None, max_age=False) + 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 0 == self.backend.can_post(u'hello ♥', public=True) diff --git a/modules/pastebin/test.py b/modules/pastebin/test.py index e04000fb..040dc77d 100644 --- a/modules/pastebin/test.py +++ b/modules/pastebin/test.py @@ -29,9 +29,9 @@ class PastebinTest(BackendTest): # html method p = self.backend.get_paste(_id) self.backend.fillobj(p, ['title']) - assert p.title == 'plop' + assert p.title == u'plop' assert p.page_url == 'http://pastebin.com/7HmXwzyt' - assert p.contents == 'prout' + assert p.contents == u'prout' assert p.public is True # raw method @@ -39,21 +39,21 @@ class PastebinTest(BackendTest): self.backend.fillobj(p, ['contents']) assert p.title is NotLoaded assert p.page_url == 'http://pastebin.com/7HmXwzyt' - assert p.contents == 'prout' + assert p.contents == u'prout' assert p.public is NotLoaded 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) assert p.id self.backend.fill_paste(p, ['title']) - assert p.title == 'ouiboube' + assert p.title == u'ouiboube' assert p.id in p.page_url assert p.public is True def test_specialchars(self): # post a paste and get the contents through the HTML response - p1 = self.backend.new_paste(None, title='ouiboube', contents=u'Weboob ¿¡', public=False) + p1 = self.backend.new_paste(None, title=u'ouiboube', contents=u'Weboob ¿¡', public=False) self.backend.post_paste(p1, max_age=600) assert p1.id # 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 def test_can_post(self): - assert self.backend.can_post('hello', public=None) > 0 - assert self.backend.can_post('hello', public=True) > 0 - assert self.backend.can_post('hello', public=False) > 0 - assert self.backend.can_post('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('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('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=None) > 0 + assert self.backend.can_post(u'hello', public=True) > 0 + assert self.backend.can_post(u'hello', public=False) > 0 + assert self.backend.can_post(u'hello', public=True, max_age=600) > 0 + assert self.backend.can_post(u'hello', public=True, max_age=3600*24) > 0 + assert self.backend.can_post(u'hello', public=True, max_age=3600*24*3) > 0 + assert self.backend.can_post(u'hello', public=True, max_age=False) > 0 + assert self.backend.can_post(u'hello', public=None, max_age=False) > 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'hello ♥', public=True) > 0