##// END OF EJS Templates
Removed invalid requirements item
Removed invalid requirements item

File last commit:

r1088:9cc4c6f4 default
r1510:04249065 decentral
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
Refactored websockets notifications and updating threads when updating posts
r1088 HTTP_CODE_REDIRECT = 302
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]
neko259
Refactored websockets notifications and updating threads when updating posts
r1088 .get_thread()).id
neko259
Split tests module into separate modules
r821 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')