# Path: account/factories.py
# class AccountFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = Account
# 
#     user = factory.SubFactory(UserFactory)
# 
# class RelationshipFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = Relationship
# 
#     owner = factory.SubFactory(AccountFactory)
#     follow = factory.SubFactory(AccountFactory)
# 
# DEFAULT_PASSWORD = 'abc@123'
# 
# Path: link/factories.py
# class PostFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = Post
# 
#     owner = factory.SubFactory(AccountFactory)
#     publisher = factory.SubFactory(AccountFactory)
#     url = 'http://test.tst'
#     type = 'html'
#     title = factory.sequence(lambda n: 'Title Link Test {}'.format(n))
#     summary = factory.sequence(lambda n: 'Summary Link Test {}'.format(n))
#     text = factory.sequence(lambda n: 'Summary Link Test {}'.format(n))
#     image_url = factory.sequence(lambda n: 'Summary Link Test {}'.format(n))


from django.test import TestCase
from django.core.urlresolvers import reverse
from account.factories import AccountFactory, RelationshipFactory, DEFAULT_PASSWORD
from link.factories import PostFactory



class TestSearch(TestCase):
    def setUp(self):
        account0 = AccountFactory.create(user__first_name='Search 0')
        account1 = AccountFactory.create(user__first_name='Search 1')
        account2 = AccountFactory.create(user__first_name='Search 2')
        RelationshipFactory.create(owner=account0, follow=account1)
        RelationshipFactory.create(owner=account1, follow=account2)

# Path: account/factories.py
# class AccountFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = Account
# 
#     user = factory.SubFactory(UserFactory)
# 
# class RelationshipFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = Relationship
# 
#     owner = factory.SubFactory(AccountFactory)
#     follow = factory.SubFactory(AccountFactory)
# 
# DEFAULT_PASSWORD = 'abc@123'
# 
# Path: link/factories.py
# class PostFactory(factory.DjangoModelFactory):
#     class Meta:
#         model = Post
# 
#     owner = factory.SubFactory(AccountFactory)
#     publisher = factory.SubFactory(AccountFactory)
#     url = 'http://test.tst'
#     type = 'html'
#     title = factory.sequence(lambda n: 'Title Link Test {}'.format(n))
#     summary = factory.sequence(lambda n: 'Summary Link Test {}'.format(n))
#     text = factory.sequence(lambda n: 'Summary Link Test {}'.format(n))
#     image_url = factory.sequence(lambda n: 'Summary Link Test {}'.format(n))


# Path: search/tests.py
from django.test import TestCase
from django.core.urlresolvers import reverse
from account.factories import AccountFactory, RelationshipFactory, DEFAULT_PASSWORD
from link.factories import PostFactory




class TestSearch(TestCase):
    def setUp(self):
        account0 = AccountFactory.create(user__first_name='Search 0')
        account1 = AccountFactory.create(user__first_name='Search 1')
        account2 = AccountFactory.create(user__first_name='Search 2')
        RelationshipFactory.create(owner=account0, follow=account1)
        RelationshipFactory.create(owner=account1, follow=account2)

        [PostFactory.create(owner=account0, publisher=account0,