diff options
Diffstat (limited to 'askbot/tests')
-rw-r--r-- | askbot/tests/management_command_tests.py | 11 | ||||
-rw-r--r-- | askbot/tests/question_views_tests.py | 5 |
2 files changed, 7 insertions, 9 deletions
diff --git a/askbot/tests/management_command_tests.py b/askbot/tests/management_command_tests.py index e9341a8b..f1c6728d 100644 --- a/askbot/tests/management_command_tests.py +++ b/askbot/tests/management_command_tests.py @@ -34,20 +34,19 @@ class ManagementCommandTests(AskbotTestCase): question = self.post_question(user=user_one) comment = self.post_comment(user=user_one, parent_post=question) number_of_gold = 50 - user_one.gold = number_of_gold + user_one.gold = number_of_gold reputation = 20 - user_one.reputation = reputation + user_one.reputation = reputation user_one.save() # Create a second user and transfer all objects from 'user_one' to 'user_two' user_two = self.create_user(username='unique') + user_two_pk = user_two.pk management.call_command('merge_users', user_one.id, user_two.id) # Check that the first user was deleted self.assertEqual(models.User.objects.filter(pk=user_one.id).count(), 0) # Explicitly check that the values assigned to user_one are now user_two's self.assertEqual(user_two.posts.get_questions().filter(pk=question.id).count(), 1) self.assertEqual(user_two.posts.get_comments().filter(pk=comment.id).count(), 1) - #todo: change groups to django groups - #then replace to 3 back to 2 in the line below - user_two = models.User.objects.get(pk=2) - self.assertEqual(user_two.gold, number_of_gold) + user_two = models.User.objects.get(pk=user_two_pk) + self.assertEqual(user_two.gold, number_of_gold) self.assertEqual(user_two.reputation, reputation) diff --git a/askbot/tests/question_views_tests.py b/askbot/tests/question_views_tests.py index 9486b854..da3e081d 100644 --- a/askbot/tests/question_views_tests.py +++ b/askbot/tests/question_views_tests.py @@ -33,7 +33,7 @@ class PrivateQuestionViewsTests(AskbotTestCase): dom = BeautifulSoup(response2.content) title = dom.find('h1').text self.assertTrue(unicode(const.POST_STATUS['private']) in title) - question = models.Thread.objects.get(id=1) + question = models.Thread.objects.get() self.assertEqual(question.title, self.qdata['title']) self.assertFalse(models.Group.objects.get_global_group() in set(question.groups.all())) @@ -114,7 +114,7 @@ class PrivateQuestionViewsTests(AskbotTestCase): class PrivateAnswerViewsTests(AskbotTestCase): - + def setUp(self): self._backup = askbot_settings.GROUPS_ENABLED askbot_settings.update('GROUPS_ENABLED', True) @@ -147,7 +147,6 @@ class PrivateAnswerViewsTests(AskbotTestCase): response = self.client.get(self.question.get_absolute_url()) self.assertFalse('some answer text' in response.content) - def test_private_checkbox_is_on_when_editing_private_answer(self): answer = self.post_answer( question=self.question, user=self.user, is_private=True |