def test_logged_in_not_ajax(self): picture = Picture.objects.get(slug='TestPicture1') data = {unicode(picture.id): u'3'} add_permission(self.user, self.perm) self.client.login(username='******', password='******') self.client.post(self.url, data) picture = Picture.objects.get(slug='TestPicture1') self.failIf(picture.order)
def test_get_method(self): picture = Picture.objects.get(slug='TestPicture1') data = {unicode(picture.id): u'3'} add_permission(self.user, self.perm) self.client.login(username='******', password='******') self.client.get(self.url, data, **{'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'}) picture = Picture.objects.get(slug='TestPicture1') self.failIf(picture.order)
def test_logged_in_is_ajax(self): picture = Picture.objects.get(slug='TestPicture1') data = {unicode(picture.id): u'3'} add_permission(self.user, self.perm) self.client.login(username='******', password='******') self.client.post(self.url, data, **{'HTTP_X_REQUESTED_WITH':'XMLHttpRequest'}) picture = Picture.objects.get(slug='TestPicture1') self.assertEquals(3, picture.order)
def test_valid_invalid_mix(self): add_permission(self.user, self.perm) self.client.login(username='******', password='******') f = file('%s/mixed_images.zip' % self.path) data = {u'gallery': self.gallery.id, u'zip_file': f} response = self.client.post(self.url, data) f.close() pictures = Picture.objects.filter(gallery=self.gallery.id) self.assertEquals(2, len(pictures)) self.assertRedirects(response, self.redirect)