<commit_before>from .. import handlers, views
from .factories import NodeRedirectFactory
from conman.tests.utils import IntegrationTestCase, RequestTestCase
from conman.nav_tree.tests.factories import ChildNodeFactory, RootNodeFactory


class TestNodeRedirectView(RequestTestCase):
    view = views.NodeRedirectView

    def test_get(self):
        request = self.create_request()
        target = RootNodeFactory.create()
        handler_path = handlers.NodeRedirectHandler.path()
        node = ChildNodeFactory(parent=target, handler=handler_path)
        node_redirect = NodeRedirectFactory.create(target=target, node=node)
        handler = node_redirect.node.get_handler()

        response = self.view.as_view()(request, handler=handler)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(response._headers['location'][1], target.url)
<commit_msg>Nicer assertion in tests<commit_after>from .. import handlers, views
from .factories import NodeRedirectFactory
from conman.tests.utils import IntegrationTestCase, RequestTestCase
from conman.nav_tree.tests.factories import ChildNodeFactory, RootNodeFactory


class TestNodeRedirectView(RequestTestCase):
    view = views.NodeRedirectView

    def test_get(self):
        request = self.create_request()
        target = RootNodeFactory.create()
        handler_path = handlers.NodeRedirectHandler.path()
        node = ChildNodeFactory(parent=target, handler=handler_path)
        node_redirect = NodeRedirectFactory.create(target=target, node=node)
        handler = node_redirect.node.get_handler()

        response = self.view.as_view()(request, handler=handler)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(response['Location'], target.url)

{'fraction_non_alphanumeric': 0.08801817149346962, 'fraction_numerical': 0.003975014196479273, 'mean_word_length': 4.388379204892966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540431', 'n_tokens_mistral': 472, 'n_tokens_neox': 451, 'n_words': 93}