def setUp(self): self.other_user = AccountFactory.create() self.other_user_post = PostFactory.create(owner=self.other_user, publisher=self.other_user) self.account = AccountFactory.create() self.user = self.account.user [ PostFactory.create(owner=self.account, publisher=self.account) for _ in range(2) ]
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, title='Search A', tags='search') for _ in range(2)] [PostFactory.create(owner=account1, publisher=account1, title='Search B', tags='search') for _ in range(2)] [PostFactory.create(owner=account2, publisher=account2, title='Search C', tags='search') for _ in range(2)] [PostFactory.create(title='Search D', tags='search') for _ in range(2)] self.user = account0.user
def test_follow_other_user(self): user2 = AccountFactory.create().user self.client.login(username=self.user.username, password=DEFAULT_PASSWORD) response = self.client.post( reverse('account_follow', args=[user2.username])) self.assertRedirects(response, reverse('profile', args=[user2.username]))
def test_unfollow_following_user(self): account2 = AccountFactory.create() RelationshipFactory.create(owner=self.account, follow=account2) self.client.login(username=self.user.username, password=DEFAULT_PASSWORD) response = self.client.post( reverse('account_unfollow', args=[account2.user.username])) self.assertRedirects(response, reverse('profile', args=[account2.user.username]))
def setUp(self): new_user = AccountFactory.build().user self.account = AccountFactory.create() self.user = self.account.user self.form_login = { 'identity': self.user.username, 'password': DEFAULT_PASSWORD, } self.form_user = { 'first_name': new_user.first_name, 'last_name': new_user.last_name, 'username': new_user.username, 'email': new_user.email, 'password': DEFAULT_PASSWORD, }
def setUp(self): account = AccountFactory.create() self.user = account.user