Commit fc7c478a authored by Bezleputh's avatar Bezleputh Committed by Florent Fourcot

[twitter] do not iterate all tweets in tests

parent ce60db2e
......@@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
import itertools
from nose.plugins.skip import SkipTest
from weboob.tools.test import BackendTest
from weboob.capabilities.base import CapBaseObject
......@@ -42,7 +43,7 @@ class TwitterTest(BackendTest):
def test_ls_me(self):
if self.backend.browser.username:
l = list(self.backend.iter_resources([CapBaseObject], ['me']))
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['me']), 0 ,20))
assert len(l)
thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content)
......@@ -50,19 +51,19 @@ class TwitterTest(BackendTest):
raise SkipTest("User credentials not defined")
def test_ls_search(self):
l = list(self.backend.iter_resources([CapBaseObject], ['search', 'weboob']))
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['search', 'weboob']), 0 ,20))
assert len(l)
thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content)
def test_ls_hashtag(self):
l = list(self.backend.iter_resources([CapBaseObject], ['hashtags', 'weboob']))
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['hashtags', 'weboob']), 0 ,20))
assert len(l)
thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content)
def test_ls_profils(self):
l = list(self.backend.iter_resources([CapBaseObject], ['profils', 'jf_cope']))
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['profils', 'jf_cope']), 0 ,20))
assert len(l)
thread = self.backend.get_thread(l[0].id)
assert len(thread.root.content)
......@@ -70,7 +71,7 @@ class TwitterTest(BackendTest):
def test_ls_trend(self):
l = list(self.backend.iter_resources([CapBaseObject], ['trendy']))
assert len(l)
l1 = list(self.backend.iter_resources([CapBaseObject], ['trendy', u'%s' % l[0].split_path[0]]))
l1 = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['trendy', u'%s' % l[0].split_path[0]]), 0 ,20))
assert len(l1)
thread = self.backend.get_thread(l1[0].id)
assert len(thread.root.content)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment