diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-05-01 17:25:05 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-05-01 17:25:05 -0400 |
commit | 794e51d7a0b125ba3cde7b442d402066ca13f8ba (patch) | |
tree | d75f26c8fecefecd10ad9d4f259c5c55294f6c86 | |
parent | 3d0a4e25c6909253a925f452aa8cbf3256dda19b (diff) | |
download | askbot-794e51d7a0b125ba3cde7b442d402066ca13f8ba.tar.gz askbot-794e51d7a0b125ba3cde7b442d402066ca13f8ba.tar.bz2 askbot-794e51d7a0b125ba3cde7b442d402066ca13f8ba.zip |
removed junk code and added follow registration for Questions
-rw-r--r-- | askbot/models/__init__.py | 25 | ||||
-rw-r--r-- | askbot/tests/follow_tests.py | 23 |
2 files changed, 26 insertions, 22 deletions
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. + ) |