Exemplo n.º 1
0
def are_connected(request_from, request_to):
    friend, friend_request, follow = Friend.are_connected(
        request_from, request_to)

    return {'friend': friend, 'friend_request': friend_request,
    'request_from': request_from, 'request_to': request_to,
    'follow': follow}
Exemplo n.º 2
0
    def test_models(self):

        friends, friend_requests, follow = Friend.are_connected(
            self.user_1, self.user_2)
        self.assertEqual(friends, 0)
        self.assertEqual(friend_requests, 0)
        self.assertEqual(follow, False)

        friend_list = Friend.friends(self.user_1)
        self.assertEqual(len(friend_list), 0)

        self.client.login(username='******', password='******')

        response = self.client.post(reverse('posts'), {'status': "1.1"})
        self.assertEqual(response.status_code, 302)

        self.client.logout()

        self.client.login(username='******', password='******')

        response = self.client.post(reverse('comment', args=[1]),
                                    {'comment': "5.1.(1.2)"})
        self.assertEqual(response.status_code, 302)

        self.client.logout()

        self.client.login(username='******', password='******')

        notification = Notification.objects.get(id=1)
        message = notification.display()
        self.assertEqual(message, "User def commented on your post")

        self.client.logout()
Exemplo n.º 3
0
    def test_models(self):

        friends, friend_requests, follow = Friend.are_connected(
            self.user_1, self.user_2)
        self.assertEqual(friends, 0)
        self.assertEqual(friend_requests, 0)
        self.assertEqual(follow, False)

        friend_list = Friend.friends(self.user_1)
        self.assertEqual(len(friend_list), 0)

        self.client.login(username='******', password='******')

        response = self.client.post(reverse('posts'),
            {'status': "1.1"})
        self.assertEqual(response.status_code, 302)

        self.client.logout()

        self.client.login(username='******', password='******')

        response = self.client.post(reverse('comment', args=[1]),
            {'comment': "5.1.(1.2)"})
        self.assertEqual(response.status_code, 302)

        self.client.logout()

        self.client.login(username='******', password='******')

        notification = Notification.objects.get(id=1)
        message = notification.display()
        self.assertEqual(message, "User def commented on your post" )

        self.client.logout()
Exemplo n.º 4
0
def are_connected(request_from, request_to):
    friend, friend_request, follow = Friend.are_connected(
        request_from, request_to)

    return {
        'friend': friend,
        'friend_request': friend_request,
        'request_from': request_from,
        'request_to': request_to,
        'follow': follow
    }