Ejemplo n.º 1
0
 def test_get_context_data(self, **kwargs):
     view = SubmitTranslationView()
     view.request = self.factory.get("/path/does/not/matter/")
     view.object = self.en_homepage
     context = view.get_context_data()
     self.assertIn("form", context.keys())
     self.assertIsInstance(context["form"], SubmitTranslationForm)
Ejemplo n.º 2
0
 def test_get_success_url(self):
     with self.assertRaises(NotImplementedError):
         view = SubmitTranslationView()
         view.object = self.en_homepage
         view.get_success_url()
Ejemplo n.º 3
0
 def test_subtitle(self):
     view = SubmitTranslationView()
     view.object = self.en_homepage
     self.assertEqual(view.get_subtitle(), str(self.en_homepage))
Ejemplo n.º 4
0
 def test_get_form(self):
     view = SubmitTranslationView()
     view.request = self.factory.get("/path/does/not/matter/")
     view.object = self.en_homepage
     form = view.get_form()
     self.assertIsInstance(form, SubmitTranslationForm)
Ejemplo n.º 5
0
 def test_title(self):
     self.assertEqual(SubmitTranslationView().title,
                      gettext_lazy("Translate"))
     self.assertEqual(SubmitTranslationView().get_title(),
                      gettext_lazy("Translate"))