##// 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 Thread.objects.process_oldest_threads()
112 Thread.objects.process_oldest_threads()
113 self.connect_replies(post)
113 self.connect_replies(post)
114
114
115 logger.info('Created post #%d with title %s and key %s'
115 logger.info('Created post #%d with title %s'
116 % (post.id, post.get_title(), post.global_id.key))
116 % (post.id, post.get_title()))
117
117
118 return post
118 return post
119
119
@@ -25,12 +25,8 b' class KeyTest(TestCase):'
25 def test_primary_constraint(self):
25 def test_primary_constraint(self):
26 KeyPair.objects.generate_key(key_type='ecdsa', primary=True)
26 KeyPair.objects.generate_key(key_type='ecdsa', primary=True)
27
27
28 try:
28 with self.assertRaises(Exception):
29 KeyPair.objects.generate_key(key_type='ecdsa', primary=True)
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 def test_model_id_save(self):
31 def test_model_id_save(self):
36 model_id = GlobalId(key_type='test', key='test key', local_id='1')
32 model_id = GlobalId(key_type='test', key='test key', local_id='1')
@@ -52,10 +48,12 b' class KeyTest(TestCase):'
52 def test_response_get(self):
48 def test_response_get(self):
53 post = self._create_post_with_key()
49 post = self._create_post_with_key()
54 reply_post = Post.objects.create_post(title='test_title',
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 reply_reply_post = Post.objects.create_post(title='',
53 reply_reply_post = Post.objects.create_post(title='',
57 text='[post]%d[/post]' % reply_post.id,
54 text='[post]%d[/post]'
58 thread=post.get_thread())
55 % reply_post.id,
56 thread=post.get_thread())
59
57
60 response = Post.objects.generate_response_get([reply_post])
58 response = Post.objects.generate_response_get([reply_post])
61 logger.debug(response)
59 logger.debug(response)
General Comments 0
You need to be logged in to leave comments. Login now