def test_06_searchcloud_displays_when_approved_data_present(self):
     #Put some data into the cloud
     searchcloud.generate_unapproved_list(model.Session, days=30)
     latest_rows = searchcloud.get_latest(model.Session)
     self.assert_equal(latest_rows, [[u'Health', 3L], [u"Water<>&\"{}'", 2L], [u'Tax\u6c49\u5b57\u6f22\u5b57', 1L]])
     searchcloud.update_approved(model.Session, latest_rows)
     approved_rows = searchcloud.get_approved(model.Session)
     self.assert_equal(latest_rows, approved_rows)
     #We'll use this test data later, so save it.
     model.Session.commit()
     # Test that the JSON text is what we expect.
     self.assert_equal(
         expected_json,
         searchcloud.approved_to_json(approved_rows)
     )
     # Now we should get a cloud
     home_url = tests.url_for('home')
     res = self.app.get(home_url)
     self.assert_equal(
         'var word_array = '+(cgi.escape(expected_json)) in res,
         True,
     )
     self.assert_equal('Popular terms' in res, True)
     self.assert_equal('jqcloud-1.0.4.min.js' in res, True)
     self.assert_equal('jqcloud.css' in res, True)
     self.assert_equal('<div id="searchcloud"' in res, True)
Exemple #2
0
 def searchcloud_generate_unapproved_search_list(self):
     '''
     This command is usually executed via a Cron job once a week to
     replace the data in the search_popular_latest table
     '''
     searchcloud.generate_unapproved_list(model.Session, days=30)
     model.Session.commit()
Exemple #3
0
 def searchcloud_generate_unapproved_search_list(self):
     '''
     This command is usually executed via a Cron job once a week to
     replace the data in the search_popular_latest table
     '''
     searchcloud.generate_unapproved_list(model.Session, days=30)
     model.Session.commit()