##// END OF EJS Templates
Fixed posting without a primary key defined. Use more proper way to assert an exception
neko259 -
r835:0f3bc07f decentral
parent child Browse files
Show More
@@ -112,8 +112,8 b' class PostManager(models.Manager):'
112 112 Thread.objects.process_oldest_threads()
113 113 self.connect_replies(post)
114 114
115 logger.info('Created post #%d with title %s and key %s'
116 % (post.id, post.get_title(), post.global_id.key))
115 logger.info('Created post #%d with title %s'
116 % (post.id, post.get_title()))
117 117
118 118 return post
119 119
@@ -25,12 +25,8 b' class KeyTest(TestCase):'
25 25 def test_primary_constraint(self):
26 26 KeyPair.objects.generate_key(key_type='ecdsa', primary=True)
27 27
28 try:
28 with self.assertRaises(Exception):
29 29 KeyPair.objects.generate_key(key_type='ecdsa', primary=True)
30 self.fail('Exception should be thrown indicating there can be only'
31 ' one primary key.')
32 except Exception:
33 pass
34 30
35 31 def test_model_id_save(self):
36 32 model_id = GlobalId(key_type='test', key='test key', local_id='1')
@@ -52,9 +48,11 b' class KeyTest(TestCase):'
52 48 def test_response_get(self):
53 49 post = self._create_post_with_key()
54 50 reply_post = Post.objects.create_post(title='test_title',
55 text='[post]%d[/post]' % post.id, thread=post.get_thread())
51 text='[post]%d[/post]' % post.id,
52 thread=post.get_thread())
56 53 reply_reply_post = Post.objects.create_post(title='',
57 text='[post]%d[/post]' % reply_post.id,
54 text='[post]%d[/post]'
55 % reply_post.id,
58 56 thread=post.get_thread())
59 57
60 58 response = Post.objects.generate_response_get([reply_post])
General Comments 0
You need to be logged in to leave comments. Login now