Ejemplo n.º 1
0
 def test_errors_surfaced(self):
     with mocked_patterns([
         url(r'^$', BrokenView.as_view()),
     ]):
         results = get_results_for('test_no_errors', covered_urls=['/'])
         self.assertEqual(
             results.failures[0][1][1].args[0],
             "The following errors were raised:\n\n"
             "/: this view is broken\n\n" +
             INSTANT_TRACEBACKS_TUTORIAL.format(name='EverythingTest')
         )
Ejemplo n.º 2
0
 def test_errors_surfaced(self):
     with override_settings(ROOT_URLCONF=patterns(
             '',
             url(r'^$', BrokenView.as_view()),
     ), ):
         results = get_results_for('test_no_errors', covered_urls=['/'])
         self.assertEqual(
             results.failures[0][1][1][0],
             "The following errors were raised:\n\n"
             "/: this view is broken\n\n" +
             INSTANT_TRACEBACKS_TUTORIAL.format(name='EverythingTest'))
Ejemplo n.º 3
0
    def test_broken_url_in_include(self):
        incl = [
            url(r'^broken-url/$', BrokenView.as_view()),
        ]

        with mocked_patterns([
            url(r'^include/', include(incl)),
        ]):
            results = get_results_for('test_no_errors',
                                      covered_urls=['/include/broken-url/'])
            self.assertEqual(
                results.failures[0][1][1].args[0],
                "The following errors were raised:\n\n"
                "/include/broken-url/: this view is broken\n\n" +
                INSTANT_TRACEBACKS_TUTORIAL.format(name='EverythingTest')
            )
Ejemplo n.º 4
0
    def test_non_list_urls(self):
        """
        Ensure you can use a tuple of URLs if you so desire.
        """

        with mocked_patterns([
            url(r'^$', BrokenView.as_view()),
            url(r'^untested/$', WorkingView.as_view()),
        ]):
            self.assertEqual(
                get_results_for('test_no_errors',
                                covered_urls='/',).failures[0][1][1].args[0],
                "The following errors were raised:\n\n"
                "/: this view is broken\n\n" +
                INSTANT_TRACEBACKS_TUTORIAL.format(name='EverythingTest')
            )
            self.assertEqual(
                get_results_for('test_all_urls_accounted_for',
                                covered_urls='/',).failures[0][1][1].args[0],
                "The following views are untested:\n\n"
                "() ^untested/$ (None)\n\n" +
                IGNORE_TUTORIAL.format(name='EverythingTest')
            )