Exemple #1
0
    def test_standard_liking_view(self):
        
        print "Testing plain GET liking..."

        # make sure we log in as larry
        self.client.login(username=self.larry.username, password=self.larry_password)

        # try to generate a like here
        response = self.client.get('/like/%d/%d' % get_like_view_params(self.post2))

        self.assertEqual(self.post2.likes.count(), self.post2likes+1)
        self.assertEqual(response.__class__, HttpResponseRedirect)
        self.print_like_counts()
Exemple #2
0
    def test_ajax_liking_view(self):

        print "Testing AJAX liking..."

        # make sure we log in as larry
        self.client.login(username=self.larry.username, password=self.larry_password)

        # try to generate a like here
        response = self.client.get('/like/%d/%d' % get_like_view_params(self.post2),
            HTTP_X_REQUESTED_WITH='XMLHttpRequest')

        self.assertEqual(self.post2.likes.count(), self.post2likes+1)
        self.assertEqual(response.__getitem__('content-type'), 'application/javascript')
        self.print_like_counts()