def test_partner_request_method_returns_username(self):
     user_one = create_test_user('1')
     user_two = create_test_user('2')
     partner_request = PartnerRequest(
         from_user=user_one,
         to_user=user_two,
     )
     self.assertEqual(str(partner_request), user_one.username)
    def test_get_shopping_partners_returns_a_list(self):
        self.client = Client()
        self.user = create_test_user('1')
        partner = create_test_user('2')
        self.client.login(username='******', password='******')

        partner_request = PartnerRequest(
            from_user = partner,
            to_user = self.user,
        )
        partner_request.save()

        shopping_partners = get_partner_requests(self)
        self.assertEqual(len(shopping_partners), 1)
 def test_category_method_returns_category(self):
     user = create_test_user('1')
     category = Category(
         user=user,
         category='test',
     )
     self.assertEqual(str(category), category.category)
 def test_like_notification_method_returns_username(self):
     user_one = create_test_user('1')
     user_two = create_test_user('2')
     user_profile = get_users_profile(user_one.id)
     status = Status(
         user=user_one,
         user_profile=user_profile,
         title='Test title',
         content='Test content',
     )
     like_notification = LikeNotification(
         user=user_one,
         status=status,
         liker=user_two,
     )
     self.assertEqual(str(like_notification),
                      like_notification.user.username)
 def test_comment_notification_method_returns_status_title(self):
     user_one = create_test_user('1')
     user_two = create_test_user('2')
     user_profile = get_users_profile(user_one.id)
     status = Status(
         user=user_one,
         user_profile=user_profile,
         title='Test title',
         content='Test content',
     )
     comment_notification = CommentNotification(
         user=user_one,
         status=status,
         commenter=user_two,
     )
     self.assertEqual(str(comment_notification),
                      comment_notification.status.title)
 def test_comment_method_returns_comment(self):
     user = create_test_user('1')
     users_profile = get_users_profile(user.id)
     user_profile = get_users_profile(user.id)
     comment = Comment(
         comment='Test comment',
         author=user,
         author_profile=user_profile,
     )
     self.assertEqual(str(comment), comment.comment)
 def test_status_method_returns_title(self):
     user = create_test_user('1')
     user_profile = get_users_profile(user.id)
     status = Status(
         user=user,
         user_profile=user_profile,
         title='Test title',
         content='Test content',
     )
     self.assertEqual(str(status), status.title)
def create_test_status():
    user = create_test_user('1')
    user_profile = get_users_profile(user.id)
    status = Status(
            user = user,
            user_profile = user_profile,
            title = 'Test Status',
            content = 'Testing test!',
        )
    status.save()

    return status
 def test_favorite_method_returns_item(self):
     user = create_test_user('1')
     category = Category(
         user=user,
         category='testCategory',
     )
     favourite = Favorite(
         user=user,
         item='testItem',
         category=category,
     )
     self.assertEqual(str(favourite), favourite.item)
 def test_purchased_items_method_returns_item(self):
     user = create_test_user('1')
     category = Category(
         user=user,
         category='testCategory',
     )
     purchased_item = PurchasedItems(
         user=user,
         item='testItem',
         category=category,
     )
     self.assertEqual(str(purchased_item), purchased_item.item)
 def test_item_method_returns_item(self):
     user = create_test_user('1')
     category = Category(
         user=user,
         category='testCategory',
     )
     item = Item(
         user=user,
         item='testItem',
         category=category,
     )
     self.assertEqual(str(item), item.item)
 def test_get_partner_request_returns_empty_list(self):
     self.client = Client()
     self.user = create_test_user('1')
     self.client.login(username='******', password='******')
     shopping_partners = get_partner_requests(self)
     self.assertEqual(len(shopping_partners), 0)
 def test_get_conversation_user_not_authenticated(self):
     user = create_test_user('1')
     message_user = User.objects.create_user('test', '*****@*****.**',
                                             'Password777')
     response = self.client.get(f'/message/conversation/{message_user.id}')
     self.assertEqual(response.status_code, 302)
 def test_partner_method_returns_username(self):
     user = create_test_user('1')
     partner = Partner(current_user=user, )
     self.assertEqual(str(partner), user.username)