Created
February 13, 2014 18:41
-
-
Save ir4y/8981172 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import pytest | |
| from websocket import create_connection | |
| @pytest.fixture(scope="module") | |
| def ws(request): | |
| ws = create_connection("ws://localhost:8080/bullet") | |
| def fin(): | |
| ws.close() | |
| request.addfinalizer(fin) | |
| return ws | |
| def test_echo(ws): | |
| ws.send("Hello, World") | |
| result = ws.recv() | |
| assert result == "Hello, World" | |
| def test_fail(ws): | |
| ws.send("Hello, World") | |
| result = ws.recv() | |
| assert result == "Hello, World1" | |
| def test_get_time(ws): | |
| result = ws.recv() | |
| assert isinstance(result, str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment