##// END OF EJS Templates
Made tests properly override posting delay variable
neko259 -
r806:3a0369a9 decentral
parent child Browse files
Show More
@@ -207,8 +207,8 b' class FormTest(TestCase):'
207
207
208 # Change posting delay so we don't have to wait for 30 seconds or more
208 # Change posting delay so we don't have to wait for 30 seconds or more
209 old_posting_delay = neboard.settings.POSTING_DELAY
209 old_posting_delay = neboard.settings.POSTING_DELAY
210 # Wait fot the posting delay or we won't be able to post
210 # Wait for the posting delay or we won't be able to post
211 settings.POSTING_DELAY = 1
211 neboard.settings.POSTING_DELAY = 1
212 time.sleep(neboard.settings.POSTING_DELAY + 1)
212 time.sleep(neboard.settings.POSTING_DELAY + 1)
213 response = client.post(THREAD_PAGE_ONE, {'text': TEST_TEXT,
213 response = client.post(THREAD_PAGE_ONE, {'text': TEST_TEXT,
214 'tags': valid_tags})
214 'tags': valid_tags})
@@ -216,7 +216,7 b' class FormTest(TestCase):'
216 msg=u'Posting new message failed: got code ' +
216 msg=u'Posting new message failed: got code ' +
217 str(response.status_code))
217 str(response.status_code))
218 # Restore posting delay
218 # Restore posting delay
219 settings.POSTING_DELAY = old_posting_delay
219 neboard.settings.POSTING_DELAY = old_posting_delay
220
220
221 self.assertEqual(2, Post.objects.count(),
221 self.assertEqual(2, Post.objects.count(),
222 msg=u'No posts were created')
222 msg=u'No posts were created')
@@ -279,7 +279,7 b' class KeyTest(TestCase):'
279 message = 'msg'
279 message = 'msg'
280 signature = key.sign(message)
280 signature = key.sign(message)
281 valid = KeyPair.objects.verify(key.public_key, message, signature,
281 valid = KeyPair.objects.verify(key.public_key, message, signature,
282 key_type='ecdsa')
282 key_type='ecdsa')
283
283
284 self.assertTrue(valid, 'Message verification failed.')
284 self.assertTrue(valid, 'Message verification failed.')
285
285
@@ -288,7 +288,8 b' class KeyTest(TestCase):'
288
288
289 try:
289 try:
290 KeyPair.objects.generate_key(key_type='ecdsa', primary=True)
290 KeyPair.objects.generate_key(key_type='ecdsa', primary=True)
291 self.fail('Exception should be thrown indicating there can be only one primary key.')
291 self.fail('Exception should be thrown indicating there can be only'
292 ' one primary key.')
292 except Exception:
293 except Exception:
293 pass
294 pass
294
295
@@ -327,7 +328,8 b' class ApiTest(TestCase):'
327
328
328 empty_response = api_get_threaddiff(MockRequest(),
329 empty_response = api_get_threaddiff(MockRequest(),
329 str(opening_post.thread_new.id),
330 str(opening_post.thread_new.id),
330 str(datetime_to_epoch(reply.last_edit_time)))
331 str(datetime_to_epoch(
332 reply.last_edit_time)))
331 diff = simplejson.loads(empty_response.content)
333 diff = simplejson.loads(empty_response.content)
332 self.assertEqual(0, len(diff['added']),
334 self.assertEqual(0, len(diff['added']),
333 'There must be no added posts in the diff.')
335 'There must be no added posts in the diff.')
General Comments 0
You need to be logged in to leave comments. Login now