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)
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()