##// END OF EJS Templates
Fixed page 404 test. Added a cat image to the banned page.
neko259 -
r181:fcbeb0b1 default
parent child Browse files
Show More
1 NO CONTENT: new file 100644, binary diff hidden
@@ -7,5 +7,6 b''
7 7 {% endblock %}
8 8
9 9 {% block staticcontent %}
10 {% trans 'Your IP address has been banned. Contact the administrator' %}
10 <p><img src="{{ STATIC_URL }}images/banned.png" width="200" /></p>
11 <p>{% trans 'Your IP address has been banned. Contact the administrator' %}</p>
11 12 {% endblock %} No newline at end of file
@@ -113,13 +113,18 b' class BoardTests(TestCase):'
113 113 self.assertEqual(1, Post.objects.count(), msg='The validation passed '
114 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 118 # Wait fot the posting delay or we won't be able to post
119 settings.POSTING_DELAY = 1
117 120 time.sleep(settings.POSTING_DELAY + 1)
118 121 response = client.post(THREAD_PAGE_ONE, {'text': TEST_TEXT,
119 122 'tags': valid_tags})
120 123 self.assertEqual(HTTP_CODE_REDIRECT, response.status_code,
121 124 msg=u'Posting new message failed: got code ' +
122 125 str(response.status_code))
126 # Restore posting delay
127 settings.POSTING_DELAY = old_posting_delay
123 128
124 129 self.assertEqual(2, Post.objects.count(),
125 130 msg=u'No posts were created')
@@ -127,8 +132,6 b' class BoardTests(TestCase):'
127 132 # Restore captcha setting
128 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 135 def test_404(self):
133 136 """Test receiving error 404 when opening a non-existent page"""
134 137
@@ -149,9 +152,8 b' class BoardTests(TestCase):'
149 152
150 153 response_not_existing = client.get(THREAD_PAGE + str(
151 154 existing_post_id + 1) + '/')
152 response_not_existing.get_full_path()
153 self.assertEqual(HTTP_CODE_NOT_FOUND,
154 response_not_existing.status_code,
155 self.assertEqual('boards/404.html',
156 response_not_existing.templates[0].name,
155 157 u'Not existing thread is opened')
156 158
157 159 response_existing = client.get(TAG_PAGE + tag_name + '/')
@@ -160,14 +162,14 b' class BoardTests(TestCase):'
160 162 u'Cannot open existing tag')
161 163
162 164 response_not_existing = client.get(TAG_PAGE + u'not_tag' + '/')
163 self.assertEqual(HTTP_CODE_NOT_FOUND,
164 response_not_existing.status_code,
165 self.assertEqual('boards/404.html',
166 response_not_existing.templates[0].name,
165 167 u'Not existing tag is opened')
166 168
167 169 reply_id = Post.objects.create_post('', TEST_TEXT,
168 parent_id=existing_post_id)
170 thread=Post.objects.all()[0])
169 171 response_not_existing = client.get(THREAD_PAGE + str(
170 172 reply_id) + '/')
171 self.assertEqual(HTTP_CODE_NOT_FOUND,
172 response_not_existing.status_code,
173 u'Not existing thread is opened')
173 self.assertEqual('boards/404.html',
174 response_not_existing.templates[0].name,
175 u'Reply is opened as a thread')
@@ -82,9 +82,6 b' def _new_post(request, form, thread_id=b'
82 82 tag, created = Tag.objects.get_or_create(name=tag_name)
83 83 tags.append(tag)
84 84
85 # TODO Add a possibility to define a link image instead of an image file.
86 # If a link is given, download the image automatically.
87
88 85 op = None if thread_id == boards.models.NO_PARENT else \
89 86 get_object_or_404(Post, id=thread_id)
90 87 post = Post.objects.create_post(title=title, text=text, ip=ip,
General Comments 0
You need to be logged in to leave comments. Login now