Example #1
0
    def test_save_to_search_index(self):
        entry = EntryFactory.create(published=True)
        job = self.queue.enqueue(save_to_search_index, 'writings.Entry', entry.id)
        doc_id = calculate_doc_id('writings.Entry', entry.id)

        self.assertEqual(job.status, 'finished')
        self.assertEqual(job.return_value, doc_id)
Example #2
0
    def test_save_to_search_index(self):
        entry = EntryFactory.create(published=True)
        job = self.queue.enqueue(save_to_search_index, 'writings.Entry',
                                 entry.id)
        doc_id = calculate_doc_id('writings.Entry', entry.id)

        self.assertEqual(job.status, 'finished')
        self.assertEqual(job.return_value, doc_id)
Example #3
0
    def test_handle_model_post_save(self):
        # mocks.patch doesn't work with rq. Not sure how to test further
        entry = EntryFactory.create(published=True)
        job = self.queue.enqueue(handle_model_post_save, 'writings.Entry', entry.id)
        doc_id = calculate_doc_id('writings.Entry', entry.id)

        self.assertEqual(job.status, 'finished')
        self.assertEqual(job.return_value, doc_id)
Example #4
0
    def test_handle_model_post_save(self):
        # mocks.patch doesn't work with rq. Not sure how to test further
        entry = EntryFactory.create(published=True)
        job = self.queue.enqueue(handle_model_post_save, 'writings.Entry',
                                 entry.id)
        doc_id = calculate_doc_id('writings.Entry', entry.id)

        self.assertEqual(job.status, 'finished')
        self.assertEqual(job.return_value, doc_id)
Example #5
0
    def test_handle_model_post_delete(self):
        entry = EntryFactory.create(published=True)
        entry_id = entry.id
        doc_id = calculate_doc_id('writings.Entry', entry_id)

        save_job = self.queue.enqueue(save_to_search_index, 'writings.Entry', entry_id)

        self.assertEqual(save_job.status, 'finished')
        self.assertEqual(save_job.return_value, doc_id)

        entry.delete()
        job = self.queue.enqueue(handle_model_post_delete, 'writings.Entry', entry_id)

        self.assertEqual(job.status, 'finished')
        self.assertEqual(job.return_value, doc_id)
Example #6
0
    def test_handle_model_post_delete(self):
        entry = EntryFactory.create(published=True)
        entry_id = entry.id
        doc_id = calculate_doc_id('writings.Entry', entry_id)

        save_job = self.queue.enqueue(save_to_search_index, 'writings.Entry',
                                      entry_id)

        self.assertEqual(save_job.status, 'finished')
        self.assertEqual(save_job.return_value, doc_id)

        entry.delete()
        job = self.queue.enqueue(handle_model_post_delete, 'writings.Entry',
                                 entry_id)

        self.assertEqual(job.status, 'finished')
        self.assertEqual(job.return_value, doc_id)
Example #7
0
    def test_calculate_doc_id(self):
        doc_id = calculate_doc_id('writings.Entry', 411)

        label, pk = doc_id.split(DOC_ID_SEPARATOR)
        self.assertEqual(label, 'writings.Entry')
        self.assertEqual(pk, '411')
Example #8
0
    def test_calculate_doc_id(self):
        doc_id = calculate_doc_id('writings.Entry', 411)

        label, pk = doc_id.split(DOC_ID_SEPARATOR)
        self.assertEqual(label, 'writings.Entry')
        self.assertEqual(pk, '411')