From 794e51d7a0b125ba3cde7b442d402066ca13f8ba Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 1 May 2011 17:25:05 -0400 Subject: removed junk code and added follow registration for Questions --- askbot/models/__init__.py | 25 +++---------------------- askbot/tests/follow_tests.py | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 askbot/tests/follow_tests.py diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 8f62871b..59967a88 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -2447,30 +2447,10 @@ signals.post_updated.connect( ) signals.site_visited.connect(record_user_visit) +#set up a possibility for the users to follow others from follow import util as follow_util follow_util.register(User, m2m = True) - -#todo: wtf??? what is x=x about? - -Question = Question -QuestionRevision = QuestionRevision -QuestionView = QuestionView -FavoriteQuestion = FavoriteQuestion -AnonymousQuestion = AnonymousQuestion - -Answer = Answer -AnswerRevision = AnswerRevision -AnonymousAnswer = AnonymousAnswer - - -BadgeData = BadgeData -Award = Award -Repute = Repute - -Activity = Activity -ActivityAuditStatus = ActivityAuditStatus -EmailFeedSetting = EmailFeedSetting -#AuthKeyUserAssociation = AuthKeyUserAssociation +follow_util.register(Question, m2m = True) __all__ = [ 'signals', @@ -2503,3 +2483,4 @@ __all__ = [ 'get_model' ] + diff --git a/askbot/tests/follow_tests.py b/askbot/tests/follow_tests.py new file mode 100644 index 00000000..b6eb555a --- /dev/null +++ b/askbot/tests/follow_tests.py @@ -0,0 +1,23 @@ +from askbot.tests.utils import AskbotTestCase + +class UserFollowTests(AskbotTestCase): + + def setUp(self): + self.u1 = self.create_user('user1') + self.u2 = self.create_user('user2') + self.u3 = self.create_user('user3') + + def test_user_follow(self): + + self.u1.follow(self.u2) + self.u1.follow(self.u3) + self.u2.follow(self.u1) + + self.assertEquals( + set(self.u1.followers()), + set([self.u2]) + ) + + self.assertEquals( + set(self.u1. + ) -- cgit v1.2.3-1-g7c22