File: test_notebookapp.py

package info (click to toggle)
nbclassic 0.3.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: python: 1,492; makefile: 25; sh: 7
file content (39 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Basic tests for the notebook handlers.
"""

import pytest


@pytest.fixture
def notebooks(jp_create_notebook):
    nbpaths = (
        'notebook1.ipynb',
        'nbclassic_test_notebooks/notebook2.ipynb',
        'nbclassic_test_notebooks/level2/notebook3.ipynb'
    )
    for nb in nbpaths:
        jp_create_notebook(nb)
    return nbpaths


async def test_tree_handler(notebooks, jp_fetch):
    r = await jp_fetch('tree', 'nbclassic_test_notebooks')
    assert r.code == 200

    # Check that the tree template is loaded
    html = r.body.decode()
    assert "Files" in html
    assert "Running" in html
    assert "Clusters" in html


async def test_notebook_handler(notebooks, jp_fetch):
    for nbpath in notebooks:
        r = await jp_fetch('notebooks', nbpath)
        assert r.code == 200
        # Check that the notebook template is loaded
        html = r.body.decode()
        assert "Menu" in html
        assert "Kernel" in html
        assert nbpath in html