|
@@
-113,13
+113,18
b' class BoardTests(TestCase):'
|
|
113
|
self.assertEqual(1, Post.objects.count(), msg='The validation passed '
|
|
113
|
self.assertEqual(1, Post.objects.count(), msg='The validation passed '
|
|
114
|
'where it should fail')
|
|
114
|
'where it should fail')
|
|
115
|
|
|
115
|
|
|
|
|
|
116
|
# Change posting delay so we don't have to wait for 30 seconds or more
|
|
|
|
|
117
|
old_posting_delay = settings.POSTING_DELAY
|
|
116
|
# Wait fot the posting delay or we won't be able to post
|
|
118
|
# Wait fot the posting delay or we won't be able to post
|
|
|
|
|
119
|
settings.POSTING_DELAY = 1
|
|
117
|
time.sleep(settings.POSTING_DELAY + 1)
|
|
120
|
time.sleep(settings.POSTING_DELAY + 1)
|
|
118
|
response = client.post(THREAD_PAGE_ONE, {'text': TEST_TEXT,
|
|
121
|
response = client.post(THREAD_PAGE_ONE, {'text': TEST_TEXT,
|
|
119
|
'tags': valid_tags})
|
|
122
|
'tags': valid_tags})
|
|
120
|
self.assertEqual(HTTP_CODE_REDIRECT, response.status_code,
|
|
123
|
self.assertEqual(HTTP_CODE_REDIRECT, response.status_code,
|
|
121
|
msg=u'Posting new message failed: got code ' +
|
|
124
|
msg=u'Posting new message failed: got code ' +
|
|
122
|
str(response.status_code))
|
|
125
|
str(response.status_code))
|
|
|
|
|
126
|
# Restore posting delay
|
|
|
|
|
127
|
settings.POSTING_DELAY = old_posting_delay
|
|
123
|
|
|
128
|
|
|
124
|
self.assertEqual(2, Post.objects.count(),
|
|
129
|
self.assertEqual(2, Post.objects.count(),
|
|
125
|
msg=u'No posts were created')
|
|
130
|
msg=u'No posts were created')
|
|
@@
-127,8
+132,6
b' class BoardTests(TestCase):'
|
|
127
|
# Restore captcha setting
|
|
132
|
# Restore captcha setting
|
|
128
|
settings.ENABLE_CAPTCHA = captcha_enabled
|
|
133
|
settings.ENABLE_CAPTCHA = captcha_enabled
|
|
129
|
|
|
134
|
|
|
130
|
# TODO This test fails for now. We must check for 404.html instead of
|
|
|
|
|
131
|
# code 404
|
|
|
|
|
132
|
def test_404(self):
|
|
135
|
def test_404(self):
|
|
133
|
"""Test receiving error 404 when opening a non-existent page"""
|
|
136
|
"""Test receiving error 404 when opening a non-existent page"""
|
|
134
|
|
|
137
|
|
|
@@
-149,9
+152,8
b' class BoardTests(TestCase):'
|
|
149
|
|
|
152
|
|
|
150
|
response_not_existing = client.get(THREAD_PAGE + str(
|
|
153
|
response_not_existing = client.get(THREAD_PAGE + str(
|
|
151
|
existing_post_id + 1) + '/')
|
|
154
|
existing_post_id + 1) + '/')
|
|
152
|
response_not_existing.get_full_path()
|
|
155
|
self.assertEqual('boards/404.html',
|
|
153
|
self.assertEqual(HTTP_CODE_NOT_FOUND,
|
|
156
|
response_not_existing.templates[0].name,
|
|
154
|
response_not_existing.status_code,
|
|
|
|
|
155
|
u'Not existing thread is opened')
|
|
157
|
u'Not existing thread is opened')
|
|
156
|
|
|
158
|
|
|
157
|
response_existing = client.get(TAG_PAGE + tag_name + '/')
|
|
159
|
response_existing = client.get(TAG_PAGE + tag_name + '/')
|
|
@@
-160,14
+162,14
b' class BoardTests(TestCase):'
|
|
160
|
u'Cannot open existing tag')
|
|
162
|
u'Cannot open existing tag')
|
|
161
|
|
|
163
|
|
|
162
|
response_not_existing = client.get(TAG_PAGE + u'not_tag' + '/')
|
|
164
|
response_not_existing = client.get(TAG_PAGE + u'not_tag' + '/')
|
|
163
|
self.assertEqual(HTTP_CODE_NOT_FOUND,
|
|
165
|
self.assertEqual('boards/404.html',
|
|
164
|
response_not_existing.status_code,
|
|
166
|
response_not_existing.templates[0].name,
|
|
165
|
u'Not existing tag is opened')
|
|
167
|
u'Not existing tag is opened')
|
|
166
|
|
|
168
|
|
|
167
|
reply_id = Post.objects.create_post('', TEST_TEXT,
|
|
169
|
reply_id = Post.objects.create_post('', TEST_TEXT,
|
|
168
|
parent_id=existing_post_id)
|
|
170
|
thread=Post.objects.all()[0])
|
|
169
|
response_not_existing = client.get(THREAD_PAGE + str(
|
|
171
|
response_not_existing = client.get(THREAD_PAGE + str(
|
|
170
|
reply_id) + '/')
|
|
172
|
reply_id) + '/')
|
|
171
|
self.assertEqual(HTTP_CODE_NOT_FOUND,
|
|
173
|
self.assertEqual('boards/404.html',
|
|
172
|
response_not_existing.status_code,
|
|
174
|
response_not_existing.templates[0].name,
|
|
173
|
u'Not existing thread is opened')
|
|
175
|
u'Reply is opened as a thread')
|