Example #1
0
 def test_handle_page_not_published(self, objects, check, add, scrape):
     # It does nothing if the page isn't live and public
     objects.live.return_value.public.return_value.get.return_value = None
     check.return_value = self.page
     search.handle_page_edit_or_create(self.page, 'add')
     self.assertFalse(add.called)
Example #2
0
 def test_handle_page_edit_on_prod(self, objects, check, update, scrape):
     # It calls update_document if the method is 'update'
     objects.live.return_value.public.return_value.get.return_value = self.page
     check.return_value = self.page
     search.handle_page_edit_or_create(self.page, 'update')
     update.assert_called_with(self.page)
Example #3
0
def search_add(request, page):
    handle_page_edit_or_create(page, 'add')
Example #4
0
 def test_handle_page_edit_or_create_off_prod(self, objects, add, scrape):
     # It doesn't do anything if the environment is production
     objects.live.return_value.public.return_value.get.return_value = 'page'
     search.handle_page_edit_or_create(self.page, 'add')
     self.assertFalse(add.called)
Example #5
0
def search_update(request, page):
    handle_page_edit_or_create(page, 'update')