Ejemplo n.º 1
0
def test_head_data_id():
    import dtale.views as views

    with ExitStack() as stack:
        stack.enter_context(mock.patch('dtale.views.DATA', {'1': None, '2': None}))
        assert views.head_data_id() == '1'

    with ExitStack() as stack:
        stack.enter_context(mock.patch('dtale.views.DATA', {}))
        with pytest.raises(Exception) as error:
            views.head_data_id()
            assert error.startswith('No data associated with this D-Tale session')
Ejemplo n.º 2
0
    def root():
        """
        :class:`flask:flask.Flask` routes which redirect to dtale/main

        :return: 302 - flask.redirect('/dtale/main')
        """
        return redirect("/dtale/main/{}".format(head_data_id()))