Exemplo n.º 1
0
    def setUp(self):

        #Article.drop_collection()
        #Feed.drop_collection()

        self.article1 = Article(
            title=u'test1',
            url=
            u'http://rss.feedsportal.com/c/707/f/9951/s/2b27496a/l/0L0Sreseaux0Etelecoms0Bnet0Cactualites0Clire0Elancement0Emondial0Edu0Esamsung0Egalaxy0Es40E25980A0Bhtml/story01.htm'
        ).save()  # NOQA
        self.article2 = Article(
            title=u'test2',
            url=
            u'http://feedproxy.google.com/~r/francaistechcrunch/~3/hEIhLwVyEEI/'
        ).save()  # NOQA
        self.article3 = Article(
            title=u'test3',
            url=u'http://obi.1flow.io/absolutize_test_401').save()  # NOQA
        self.article4 = Article(
            title=u'test4',
            url=u'http://host.non.exixstentz.com/absolutize_test').save(
            )  # NOQA
        self.article5 = Article(
            title=u'test5',
            url=u'http://1flow.io/absolutize_test_404').save()  # NOQA
Exemplo n.º 2
0
    def setUp(self):

        # NOTE: we need real web pages, else the absolutization won't work or
        # will find duplicates and tests will fail for a real-life reason.
        self.article1 = Article(title='test1',
                                url='http://blog.1flow.io/post/'
                                '59410536612/1flow-blog-has-moved').save()

        self.feed = Feed(name='1flow test feed',
                         url='http://blog.1flow.io/rss').save()

        self.article1.update(add_to_set__feeds=self.feed)
        self.article1.reload()

        # User & Reads creation
        for index in xrange(1, 2):
            username = '******' % index
            du = DjangoUser.objects.create(username=username,
                                           email='*****@*****.**' % username)
            # PG post_save() signal already created the MongoDB user.
            u = du.mongo
            Read(user=u, article=self.article1).save()
            Subscription(user=u, feed=self.feed).save()

        for index in xrange(2, 5):
            username = '******' % index
            du = DjangoUser.objects.create(username=username,
                                           email='*****@*****.**' % username)
Exemplo n.º 3
0
    def setUp(self):

        # NOTE: we need real web pages, else the absolutization won't work or
        # will find duplicates and tests will fail for a real-life reason.
        self.article1 = Article(title='test1',
                                url='http://blog.1flow.io/post/'
                                '59410536612/1flow-blog-has-moved').save()
        self.article2 = Article(title='test2',
                                url='http://obi.1flow.io/fr/').save()
        self.article3 = Article(title='test3',
                                url='http://obi.1flow.io/en/').save()

        # User & Reads creation
        for index in xrange(1, 6):
            username = '******' % index
            du = DjangoUser.objects.create(username=username,
                                           email='*****@*****.**' % username)
            # NOTE: the mongoDB user is created automatically. If you
            # try to create one it will fail with duplicate index error.
            u = du.mongo
            Read(user=u, article=self.article1).save()

        for index in xrange(6, 11):
            username = '******' % index
            du = DjangoUser.objects.create(username=username,
                                           email='*****@*****.**' % username)
            u = du.mongo
            Read(user=u, article=self.article2).save()

        # Feeds creation
        for index in xrange(1, 6):
            f = Feed(name='test feed #%s' % index,
                     url='http://test-feed%s.com' % index).save()
            self.article1.update(add_to_set__feeds=f)

            self.article1.reload()

        for index in xrange(6, 11):
            f = Feed(name='test feed #%s' % index,
                     url='http://test-feed%s.com' % index).save()
            self.article2.update(add_to_set__feeds=f)

            self.article2.reload()
Exemplo n.º 4
0
    def setUp(self):

        # NOTE: we need real web pages, else the absolutization won't work or
        # will find duplicates and tests will fail for a real-life reason.
        # Here we need to keep an article without any url_error, so we have
        # to make it point to a real working URL.
        self.a1 = Article(
            title='ErrorClassifierTests #1',
            url='http://blog.1flow.io/post/59410536612/1flow-blog-has-moved'
        ).save()  # NOQA

        self.a2 = Article(
            title='ErrorClassifierTests #2',
            url='http://t.co/t2',
            url_error=
            "HTTPConnectionPool(host='t.co', port=80): Max retries exceeded with url: /t1 (Caused by <class 'socket.error'>: [Errno 60] Operation timed out)"
        ).save()  # NOQA
        self.a3 = Article(
            title='ErrorClassifierTests #3',
            url='http://t.co/t3',
            url_error=
            "HTTP Error 404 (Not Found) while resolving http://t.co/t3.").save(
            )  # NOQA
        self.a4 = Article(
            title='ErrorClassifierTests #4',
            url='http://t.co/t4',
            url_error=
            "HTTP Error 404 (Not Found) while resolving http://t.co/t4.").save(
            )  # NOQA
        self.a5 = Article(
            title='ErrorClassifierTests #5',
            url='http://t.co/t5',
            url_error=
            "HTTPConnectionPool(host='t.co', port=80): Max retries exceeded with url: /t5 (Caused by <class 'socket.error'>: [Errno 65] No route to host)"
        ).save()  # NOQA
        self.a6 = Article(
            title='ErrorClassifierTests #6',
            url='http://t.co/6',
            url_error=
            "HTTPConnectionPool(host='t.co', port=80): Max retries exceeded with url: /t6 (Caused by <class 'socket.error'>: [Errno 54] Connection reset by peer)"
        ).save()  # NOQA