Exemplo n.º 1
0
    def test_import_module_fail(self):
        """Test if importing malformed view modules fails properly."""
        with self.assertRaises(AdminHttp404) as cm1:
            views.get_view_module_or_404(None)
        self.assertEqual(cm1.exception.message, "No category provided.")

        gib = gibberish()
        with self.assertRaises(AdminHttp404) as cm2:
            views.get_view_module_or_404(gib)
        with self.assertRaises(AdminHttp404) as cm3:
            views.get_json_view_or_404(gib)
        self.assertEqual(cm2.exception.message, "No category found with this name: %s" % gib)
        self.assertEqual(cm3.exception.message, "No category found with this name: %s" % gib)
Exemplo n.º 2
0
    def test_import_module_fail(self):
        """Test if importing malformed view modules fails properly."""
        with self.assertRaises(AdminHttp404) as cm1:
            views.get_view_module_or_404(None)
        self.assertEqual(cm1.exception.message, "No category provided.")

        gib = gibberish()
        with self.assertRaises(AdminHttp404) as cm2:
            views.get_view_module_or_404(gib)
        with self.assertRaises(AdminHttp404) as cm3:
            views.get_json_view_or_404(gib)
        self.assertEqual(cm2.exception.message,
                         "No category found with this name: %s" % gib)
        self.assertEqual(cm3.exception.message,
                         "No category found with this name: %s" % gib)
Exemplo n.º 3
0
    def test_import_module_success(self):
        """Test if model view modules are imported successfully."""
        mod = views.get_view_module_or_404(self.current_view)
        self.assertIsNotNone(mod)

        view = views.get_json_view_or_404(self.current_view)
        self.assertIsNotNone(view)
Exemplo n.º 4
0
    def test_import_module_success(self):
        """Test if model view modules are imported successfully."""
        mod = views.get_view_module_or_404(self.current_view)
        self.assertIsNotNone(mod)

        view = views.get_json_view_or_404(self.current_view)
        self.assertIsNotNone(view)