def test_fetch_all_start(self): self.mocked_fetch_trans.side_effect = None fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_PAGES, fp.status) self.mocked_fetch_trans.assert_called_once_with(self.fp.id, 'en-US')
def test_fetch_one_issue(self): self.set_content(TranslatedContent.STATUS_ERROR, 'Status 500, Content:\nServer Error') fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_ERROR, fp.status)
def test_fetch_all_complete(self): self.set_content(TranslatedContent.STATUS_FETCHED) self.mocked_parse_page.side_effect = None fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_PARSING, fp.status) self.mocked_parse_page.assert_called_once_with(self.fp.id)
def test_fetch_all_in_progress(self): for t in self.fp.translations(): t.status = t.STATUS_FETCHING t.save() fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_PAGES, fp.status)
def test_fetch_one_issue(self): self.set_content( TranslatedContent.STATUS_ERROR, 'Status 500, Content:\nServer Error') fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_ERROR, fp.status)
def test_fetch_one_issue(self): t = self.fp.translations()[-1] t.status = t.STATUS_ERROR t.raw = "Status 500, Content:\nServer Error" t.save() fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_ERROR, fp.status)
def test_fetch_all_complete(self): for t in self.fp.translations(): t.status = t.STATUS_FETCHED t.save() self.mocked_parse_page.side_effect = None fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_PARSING, fp.status) self.mocked_parse_page.assertCalledOnce(self.fp.id)
def test_fetch_all_complete(self): for t in self.fp.translations(): t.status = t.STATUS_FETCHED t.save() self.mocked_parse_page.side_effect = None fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_PARSING, fp.status) self.mocked_parse_page.assert_called_once_with(self.fp.id)
def test_fetch_all_after_parsed(self): self.set_content(TranslatedContent.STATUS_FETCHED) self.fp.status = self.fp.STATUS_PARSED_ERROR self.fp.save() fetch_all_translations(self.fp.id)
def test_fetch_all_in_progress(self): self.set_content(TranslatedContent.STATUS_FETCHING) fetch_all_translations(self.fp.id) fp = FeaturePage.objects.get(id=self.fp.id) self.assertEqual(fp.STATUS_PAGES, fp.status)