コード例 #1
0
ファイル: test_es.py プロジェクト: zu83/kitsune
    def test_thread_is_reindexed_on_username_change(self):
        search = ThreadMappingType.search()

        u = UserFactory(username="******")
        ThreadFactory(creator=u, title="Hello")

        self.refresh()
        eq_(search.query(post_title="hello")[0]["post_author_ord"], ["dexter"])

        # Change the username and verify the index.
        u.username = "******"
        u.save()
        self.refresh()
        eq_(search.query(post_title="hello")[0]["post_author_ord"], ["walter"])
コード例 #2
0
ファイル: test_es.py プロジェクト: 1234-/kitsune
    def test_thread_is_reindexed_on_username_change(self):
        search = ThreadMappingType.search()

        u = UserFactory(username='******')
        ThreadFactory(creator=u, title=u'Hello')

        self.refresh()
        eq_(search.query(post_title='hello')[0]['post_author_ord'], [u'dexter'])

        # Change the username and verify the index.
        u.username = '******'
        u.save()
        self.refresh()
        eq_(search.query(post_title='hello')[0]['post_author_ord'], [u'walter'])
コード例 #3
0
    def test_thread_is_reindexed_on_username_change(self):
        search = ThreadMappingType.search()

        u = UserFactory(username='******')
        ThreadFactory(creator=u, title='Hello')

        self.refresh()
        eq_(search.query(post_title='hello')[0]['post_author_ord'], ['dexter'])

        # Change the username and verify the index.
        u.username = '******'
        u.save()
        self.refresh()
        eq_(search.query(post_title='hello')[0]['post_author_ord'], ['walter'])
コード例 #4
0
ファイル: test_es.py プロジェクト: rootmeb/kitsune
    def test_question_is_reindexed_on_username_change(self):
        search = QuestionMappingType.search()

        u = UserFactory(username='******')

        QuestionFactory(creator=u, title='Hello')
        AnswerFactory(creator=u, content='I love you')
        self.refresh()
        eq_(search.query(question_title__match='hello')[0]['question_creator'],
            'dexter')
        query = search.query(question_answer_content__match='love')
        eq_(query[0]['question_answer_creator'],
            ['dexter'])

        # Change the username and verify the index.
        u.username = '******'
        u.save()
        self.refresh()
        eq_(search.query(question_title__match='hello')[0]['question_creator'],
            'walter')
        query = search.query(question_answer_content__match='love')
        eq_(query[0]['question_answer_creator'], ['walter'])
コード例 #5
0
ファイル: test_es.py プロジェクト: 1234-/kitsune
    def test_question_is_reindexed_on_username_change(self):
        search = QuestionMappingType.search()

        u = UserFactory(username='******')

        QuestionFactory(creator=u, title=u'Hello')
        AnswerFactory(creator=u, content=u'I love you')
        self.refresh()
        eq_(search.query(question_title__match='hello')[0]['question_creator'],
            u'dexter')
        query = search.query(question_answer_content__match='love')
        eq_(query[0]['question_answer_creator'],
            [u'dexter'])

        # Change the username and verify the index.
        u.username = '******'
        u.save()
        self.refresh()
        eq_(search.query(question_title__match='hello')[0]['question_creator'],
            u'walter')
        query = search.query(question_answer_content__match='love')
        eq_(query[0]['question_answer_creator'], [u'walter'])
コード例 #6
0
    def test_question_is_reindexed_on_username_change(self):
        search = QuestionMappingType.search()

        u = UserFactory(username="******")

        QuestionFactory(creator=u, title="Hello")
        AnswerFactory(creator=u, content="I love you")
        self.refresh()
        eq_(
            search.query(question_title__match="hello")[0]["question_creator"],
            "dexter")
        query = search.query(question_answer_content__match="love")
        eq_(query[0]["question_answer_creator"], ["dexter"])

        # Change the username and verify the index.
        u.username = "******"
        u.save()
        self.refresh()
        eq_(
            search.query(question_title__match="hello")[0]["question_creator"],
            "walter")
        query = search.query(question_answer_content__match="love")
        eq_(query[0]["question_answer_creator"], ["walter"])