Skip to content

Commit

Permalink
add basic view tests to maintain AuthMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
bryevdv committed Jul 27, 2020
1 parent 86cecf7 commit 4bed240
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/unit/bokeh/server/views/test_metadata_handler.py
@@ -0,0 +1,44 @@
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
import pytest ; pytest

##-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

# Bokeh imports
from bokeh.server.views.auth_mixin import AuthMixin

# Module under test
from bokeh.server.views.metadata_handler import MetadataHandler # isort:skip

#-----------------------------------------------------------------------------
# Setup
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------

def test_uses_auth_mixin() -> None:
assert issubclass(MetadataHandler, AuthMixin)

#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
44 changes: 44 additions & 0 deletions tests/unit/bokeh/server/views/test_root_handler.py
@@ -0,0 +1,44 @@
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
import pytest ; pytest

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

# Bokeh imports
from bokeh.server.views.auth_mixin import AuthMixin

# Module under test
from bokeh.server.views.root_handler import RootHandler # isort:skip

#-----------------------------------------------------------------------------
# Setup
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------

def test_uses_auth_mixin() -> None:
assert issubclass(RootHandler, AuthMixin)

#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
44 changes: 44 additions & 0 deletions tests/unit/bokeh/server/views/test_session_handler.py
@@ -0,0 +1,44 @@
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
import pytest ; pytest

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

# Bokeh imports
from bokeh.server.views.auth_mixin import AuthMixin

# Module under test
from bokeh.server.views.session_handler import SessionHandler # isort:skip

#-----------------------------------------------------------------------------
# Setup
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------

def test_uses_auth_mixin() -> None:
assert issubclass(SessionHandler, AuthMixin)

#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
4 changes: 4 additions & 0 deletions tests/unit/bokeh/server/views/test_ws.py
Expand Up @@ -21,6 +21,7 @@
from tornado.websocket import WebSocketClosedError

# Bokeh imports
from bokeh.server.views.auth_mixin import AuthMixin
from bokeh.util.logconfig import basicConfig

# Module under test
Expand Down Expand Up @@ -49,6 +50,9 @@ def send(self, handler):
assert caplog.text.endswith("Failed sending message as connection was closed\n")
assert ret is None

def test_uses_auth_mixin() -> None:
assert issubclass(WSHandler, AuthMixin)

#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
Expand Down

0 comments on commit 4bed240

Please sign in to comment.