-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18b1cc0
commit 9b2e335
Showing
2 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,34 @@ | ||
import unittest | ||
import pytest # noqa: F401 | ||
from flask import Flask | ||
|
||
import flask_sock # noqa: F401 | ||
import flask_sock | ||
|
||
|
||
class FlaskSockTestCase(unittest.TestCase): | ||
def test_dummy(self): | ||
pass | ||
def test_create_direct(self): | ||
app = Flask(__name__, static_folder=None) | ||
sock = flask_sock.Sock(app) | ||
|
||
@sock.route('/ws') | ||
def ws(ws): | ||
pass | ||
|
||
assert sock.app == app | ||
assert sock.bp is None | ||
assert app.url_map._rules[0].rule == '/ws' | ||
assert app.url_map._rules[0].websocket is True | ||
|
||
def test_create_indirect(self): | ||
app = Flask(__name__, static_folder=None) | ||
sock = flask_sock.Sock() | ||
|
||
@sock.route('/ws') | ||
def ws(ws): | ||
pass | ||
|
||
sock.init_app(app) | ||
|
||
assert sock.app is None | ||
assert sock.bp is not None | ||
assert app.url_map._rules[0].rule == '/ws' | ||
assert app.url_map._rules[0].websocket is True |