##// END OF EJS Templates
Download image in chunks and limit size even if the server has no...
Download image in chunks and limit size even if the server has no content-lenght or lies

File last commit:

r890:dec155c1 default
r965:b4b69de3 default
Show More
test_pages.py
52 lines | 1.9 KiB | text/x-python | PythonLexer
neko259
Split tests module into separate modules
r821 from django.test import TestCase, Client
from boards.models import Tag, Post
TEST_TEXT = 'test'
NEW_THREAD_PAGE = '/'
THREAD_PAGE_ONE = '/thread/1/'
THREAD_PAGE = '/thread/'
TAG_PAGE = '/tag/'
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 HTTP_CODE_REDIRECT = 301
neko259
Split tests module into separate modules
r821 HTTP_CODE_OK = 200
HTTP_CODE_NOT_FOUND = 404
class PagesTest(TestCase):
def test_404(self):
"""Test receiving error 404 when opening a non-existent page"""
tag_name = 'test_tag'
tag = Tag.objects.create(name=tag_name)
client = Client()
Post.objects.create_post('title', TEST_TEXT, tags=[tag])
existing_post_id = Post.objects.all()[0].id
response_existing = client.get(THREAD_PAGE + str(existing_post_id) +
'/')
self.assertEqual(HTTP_CODE_OK, response_existing.status_code,
'Cannot open existing thread')
response_not_existing = client.get(THREAD_PAGE + str(
existing_post_id + 1) + '/')
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 self.assertEqual(HTTP_CODE_NOT_FOUND, response_not_existing.status_code,
neko259
Split tests module into separate modules
r821 'Not existing thread is opened')
response_existing = client.get(TAG_PAGE + tag_name + '/')
self.assertEqual(HTTP_CODE_OK,
response_existing.status_code,
'Cannot open existing tag')
response_not_existing = client.get(TAG_PAGE + 'not_tag' + '/')
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 self.assertEqual(HTTP_CODE_NOT_FOUND, response_not_existing.status_code,
neko259
Split tests module into separate modules
r821 'Not existing tag is opened')
reply_id = Post.objects.create_post('', TEST_TEXT,
thread=Post.objects.all()[0]
.get_thread())
response_not_existing = client.get(THREAD_PAGE + str(
reply_id) + '/')
neko259
404 page now returns the 404 status for real. Fixed some tests related to...
r890 self.assertEqual(HTTP_CODE_REDIRECT, response_not_existing.status_code,
neko259
Split tests module into separate modules
r821 'Reply is opened as a thread')