def test_create_answer_id_spanish(self): """Test that Spanish page creation generates an Ask ID and pages.""" request = HttpRequest request.user = self.user test_page = AnswerPage( slug='spanish-page-1', title='Spanish page 1', language='es') self.spanish_landing_page.add_child(instance=test_page) test_page.save() create_answer_id(request, test_page) self.assertEqual(test_page.slug, 'spanish-page-1-es-{}'.format( Answer.objects.order_by('pk').last().pk)) self.assertIsNotNone(test_page.answer_base) self.assertIsNotNone(test_page.answer_base.english_page) self.assertIsNotNone(test_page.answer_base.spanish_page)
def test_create_answer_id_english(self): """Test that English page creation generates an Ask ID and pages.""" request = HttpRequest request.user = self.user test_page = AnswerPage(slug='test-page', title='Test page') self.english_landing_page.add_child(instance=test_page) test_page.save() create_answer_id(request, test_page) self.assertEqual( test_page.slug, 'test-page-en-{}'.format(Answer.objects.order_by('pk').last().pk)) self.assertIsNotNone(test_page.answer_base) self.assertIsNotNone(test_page.answer_base.english_page) self.assertIsNotNone(test_page.answer_base.spanish_page)