Skip to content

Commit

Permalink
Test LiveNotebookRecord init, attribute access, & equality
Browse files Browse the repository at this point in the history
  • Loading branch information
mpacer committed Jun 15, 2019
1 parent 24aef51 commit 60249b2
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions bookstore/client/tests/test_nb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,32 @@
NotebookSession,
KernelInfo,
extract_kernel_id,
LiveNotebookRecord,
)


@pytest.fixture
def notebook_server_dict():
notebook_server_dict = {
"base_url": "/",
"hostname": "localhost",
"notebook_dir": "/Users/username",
"password": False,
"pid": 20981,
"port": 8888,
"secure": False,
"token": "e5814788aeef225172364fcdf1240b90729169a2ced375c7",
"url": "http://localhost:8888/",
}
return notebook_server_dict


@pytest.fixture
def notebook_server_record(notebook_server_dict):
notebook_server_record = LiveNotebookRecord(**notebook_server_dict)
return notebook_server_record


@pytest.fixture(scope="module")
def kernel_info_dict():
info_dict = {
Expand Down Expand Up @@ -44,6 +67,19 @@ def notebook_session(session_dict):
return notebook_session


def test_notebook_server_record(notebook_server_record, notebook_server_dict):
assert notebook_server_record.base_url == notebook_server_dict['base_url']
assert notebook_server_record.hostname == notebook_server_dict["hostname"]
assert notebook_server_record.notebook_dir == notebook_server_dict["notebook_dir"]
assert notebook_server_record.password == notebook_server_dict['password']
assert notebook_server_record.pid == notebook_server_dict["pid"]
assert notebook_server_record.port == notebook_server_dict["port"]
assert notebook_server_record.secure == notebook_server_dict["secure"]
assert notebook_server_record.token == notebook_server_dict["token"]
assert notebook_server_record.url == notebook_server_dict["url"]
assert notebook_server_record == LiveNotebookRecord(**notebook_server_dict)


def test_kernel_info_class(kernel_info_dict, kernel_info):
assert kernel_info.id == kernel_info_dict['id']
assert kernel_info.name == kernel_info_dict["name"]
Expand Down

0 comments on commit 60249b2

Please sign in to comment.