Catch warnings in Sentry
Commit d7d8c pushed by Anže Pečar

15 tests 14 passed 1 failed Duration
self = <posts.tests.TestPostView testMethod=test_with_results>

    def test_with_results(self):
        account = Account.objects.create(
            account_id="1",
            instance="mastodon.social",
            username="test",
            acct="test",
            display_name="Test",
            locked=False,
            bot=False,
            discoverable=True,
            group=False,
            created_at="2021-01-01T00:00:00.000000+00:00",
            last_status_at="2021-01-01T00:00:00.000000+00:00",
            last_sync_at="2021-01-01T00:00:00.000000+00:00",
            followers_count=0,
            following_count=0,
            statuses_count=0,
            note="",
            url="https://mastodon.social/@test",
            avatar="https://mastodon.social/@test/avatar",
            avatar_static="https://mastodon.social/@test/avatar",
            header="https://mastodon.social/@test/header",
            header_static="https://mastodon.social/@test/header",
            emojis=[],
            roles=[],
            fields=[],
        )
        Post.objects.create(
            post_id="1",
            account=account,
            instance="mastodon.social",
            content="This is a test post with some content",
            visibility="public",
            favourites_count=1,
            reblogs_count=0,
            replies_count=0,
            created_at="2021-01-01T00:00:00.000000+00:00",
        )
>       result = self.client.get("/posts/2021-01-01/")

posts/tests.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/client.py:1129: in get
    response = super().get(
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/client.py:479: in get
    return self.generic(
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/client.py:676: in generic
    return self.request(**r)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/client.py:1092: in request
    self.check_exception(response)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/client.py:805: in check_exception
    raise exc_value
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/core/handlers/exception.py:55: in inner
    response = get_response(request)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/core/handlers/base.py:197: in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
posts/views.py:97: in index
    return render(
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/shortcuts.py:25: in render
    content = loader.render_to_string(template_name, context, request, using=using)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/loader.py:62: in render_to_string
    return template.render(context, request)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/backends/django.py:107: in render
    return self.template.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:171: in render
    return self._render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/utils.py:114: in instrumented_test_render
    return self.nodelist.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:1008: in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:969: in render_annotated
    return self.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/loader_tags.py:159: in render
    return compiled_parent._render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/utils.py:114: in instrumented_test_render
    return self.nodelist.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:1008: in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:969: in render_annotated
    return self.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/loader_tags.py:65: in render
    result = block.nodelist.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:1008: in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:969: in render_annotated
    return self.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/defaulttags.py:243: in render
    nodelist.append(node.render_annotated(context))
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:969: in render_annotated
    return self.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/loader_tags.py:210: in render
    return template.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:173: in render
    return self._render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/test/utils.py:114: in instrumented_test_render
    return self.nodelist.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:1008: in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/base.py:969: in render_annotated
    return self.render(context)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/template/defaulttags.py:480: in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/urls/base.py:88: in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <URLResolver 'fedidevs.urls' (None:None) '^/'>, lookup_view = 'redirect'
_prefix = '/', args = (), kwargs = {'query': ''}
possibilities = [([('redirect/%(query)s', ['query'])], 'redirect/(?P<query>.+)\\Z', {}, {'query': <django.urls.converters.PathConverter object at 0x7f4a0a57e420>})]
possibility = [('redirect/%(query)s', ['query'])]
pattern = 'redirect/(?P<query>.+)\\Z', defaults = {}
converters = {'query': <django.urls.converters.PathConverter object at 0x7f4a0a57e420>}
result = 'redirect/%(query)s', params = ['query']
candidate_subs = {'query': ''}, matches = True, k = 'query'

    def _reverse_with_prefix(self, lookup_view, _prefix, *args, **kwargs):
        if args and kwargs:
            raise ValueError("Don't mix *args and **kwargs in call to reverse()!")
    
        if not self._populated:
            self._populate()
    
        possibilities = self.reverse_dict.getlist(lookup_view)
    
        for possibility, pattern, defaults, converters in possibilities:
            for result, params in possibility:
                if args:
                    if len(args) != len(params):
                        continue
                    candidate_subs = dict(zip(params, args))
                else:
                    if set(kwargs).symmetric_difference(params).difference(defaults):
                        continue
                    matches = True
                    for k, v in defaults.items():
                        if k in params:
                            continue
                        if kwargs.get(k, v) != v:
                            matches = False
                            break
                    if not matches:
                        continue
                    candidate_subs = kwargs
                # Convert the candidate subs to text using Converter.to_url().
                text_candidate_subs = {}
                match = True
                for k, v in candidate_subs.items():
                    if k in converters:
                        try:
                            text_candidate_subs[k] = converters[k].to_url(v)
                        except ValueError:
                            match = False
                            break
                    else:
                        text_candidate_subs[k] = str(v)
                if not match:
                    continue
                # WSGI provides decoded URLs, without %xx escapes, and the URL
                # resolver operates on such URLs. First substitute arguments
                # without quoting to build a decoded URL and look for a match.
                # Then, if we have a match, redo the substitution with quoted
                # arguments in order to return a properly encoded URL.
                candidate_pat = _prefix.replace("%", "%%") + result
                if re.search(
                    "^%s%s" % (re.escape(_prefix), pattern),
                    candidate_pat % text_candidate_subs,
                ):
                    # safe characters from `pchar` definition of RFC 3986
                    url = quote(
                        candidate_pat % text_candidate_subs,
                        safe=RFC3986_SUBDELIMS + "/~:@",
                    )
                    # Don't allow construction of scheme relative urls.
                    return escape_leading_slashes(url)
        # lookup_view can be URL name or callable, but callables are not
        # friendly in error messages.
        m = getattr(lookup_view, "__module__", None)
        n = getattr(lookup_view, "__name__", None)
        if m is not None and n is not None:
            lookup_view_s = "%s.%s" % (m, n)
        else:
            lookup_view_s = lookup_view
    
        patterns = [pattern for (_, pattern, _, _) in possibilities]
        if patterns:
            if args:
                arg_msg = "arguments '%s'" % (args,)
            elif kwargs:
                arg_msg = "keyword arguments '%s'" % kwargs
            else:
                arg_msg = "no arguments"
            msg = "Reverse for '%s' with %s not found. %d pattern(s) tried: %s" % (
                lookup_view_s,
                arg_msg,
                len(patterns),
                patterns,
            )
        else:
            msg = (
                "Reverse for '%(view)s' not found. '%(view)s' is not "
                "a valid view function or pattern name." % {"view": lookup_view_s}
            )
>       raise NoReverseMatch(msg)
E       django.urls.exceptions.NoReverseMatch: Reverse for 'redirect' with keyword arguments '{'query': ''}' not found. 1 pattern(s) tried: ['redirect/(?P<query>.+)\\Z']

/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/urls/resolvers.py:831: NoReverseMatch