Beispiel #1
0
    def test_walk_visits_files(self):
        walkcmd = Walk()
        walkcmd.run()

        calls = yawt.site_manager.call_plugins.call_args_list
        self.assertEquals(4, len(calls))
        call_0_pargs = calls[0][0]
        self.assertEquals('on_pre_walk', call_0_pargs[0])

#        call_1_pargs = calls[1][0]
#        self.assertArticleVisited(call_1_pargs, 'entry2', 'txt')

#        call_2_pargs = calls[2][0]
#        self.assertArticleVisited(call_2_pargs, 'entry1', 'txt')

        call_3_pargs = calls[3][0]
        self.assertEquals('on_post_walk', call_3_pargs[0])
Beispiel #2
0
    def test_clears_index_and_reindexes_all_articles_on_walk(self):
        # quick check that there's something in the index
        self.assertEquals(3, len(search('')))
        self.assertEquals(1, len(search('content:blah')))
        self.assertEquals(1, len(search('content:random')))
        self.assertEquals(1, len(search('content:food')))

        # change contents completely
        self.site.delete_file('content/food.txt')
        self.site.delete_file('content/random.txt')
        self.site.delete_file('content/entry.txt')
        self.site.save_file('content/newentry.txt', 'newentry')

        with self.app.app_context():
            walk = Walk()
            walk.run()

            # now the extra file should be indexed
            self.assertEquals(1, len(search('')))
            self.assertEquals(1, len(search('content:newentry')))