Accepting request 927833 from devel:languages:python:flask
OBS-URL: https://build.opensuse.org/request/show/927833 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Flask-SocketIO?expand=0&rev=2
This commit is contained in:
commit
819e9ebcd1
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:4fb968c43bc384f184cd1a25c1842297c2e3d6efc2f755a61be6d4406858220f
|
|
||||||
size 15861
|
|
3
Flask-SocketIO-5.1.1.tar.gz
Normal file
3
Flask-SocketIO-5.1.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:1efdaacc7a26e94f2b197a80079b1058f6aa644a6094c0a322349e2b9c41f6b1
|
||||||
|
size 16132
|
@ -1,3 +1,19 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Oct 23 15:18:45 UTC 2021 - Axel Braun <axel.braun@gmx.de>
|
||||||
|
|
||||||
|
- Update to version 5.1.1
|
||||||
|
* Only use SSL socket if at least one SSL kwarg is not None #1639 (commit) (thanks JT Raber!)
|
||||||
|
* Remove unused SSL arguments from eventlet server options #1639 (commit)
|
||||||
|
* Remove executable permissions from files that lack shebang lines #1621 (commit) (thanks Ben Beasley!)
|
||||||
|
* Improved project structure (commit)
|
||||||
|
Release 5.1.0 - 2021-05-28
|
||||||
|
* Add reloader_options argument to socketio.run#1556 (commit)
|
||||||
|
* Pass auth data from client in connect event handler #1555 (commit)
|
||||||
|
* Do not show simple-websocket install prompt if it is already installed (commit)
|
||||||
|
* Fix namespace bug in example #1543 (commit)
|
||||||
|
* Added index to documentation #724 (commit)
|
||||||
|
* Fixed typo in documentation #1551 (commit) (thanks Mayank Anuragi!)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 25 17:24:48 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
Tue May 25 17:24:48 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
@ -12,22 +12,24 @@
|
|||||||
# license that conforms to the Open Source Definition (Version 1.9)
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
# published by the Open Source Initiative.
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python3-%{**}}
|
%{?!python_module:%define python_module() python3-%{**}}
|
||||||
%define skip_python2 1
|
%define skip_python2 1
|
||||||
Name: python-Flask-SocketIO
|
Name: python-Flask-SocketIO
|
||||||
Version: 5.0.3
|
Version: 5.1.1
|
||||||
Release: 0
|
Release: 0
|
||||||
License: MIT
|
License: MIT
|
||||||
Summary: SocketIO integration for Flask applications
|
Summary: SocketIO integration for Flask applications
|
||||||
Url: http://github.com/miguelgrinberg/Flask-SocketIO/
|
URL: http://github.com/miguelgrinberg/Flask-SocketIO/
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
Source: https://files.pythonhosted.org/packages/source/F/Flask-SocketIO/Flask-SocketIO-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/F/Flask-SocketIO/Flask-SocketIO-%{version}.tar.gz
|
||||||
Source1: https://raw.githubusercontent.com/miguelgrinberg/Flask-SocketIO/v%{version}/test_socketio.py
|
Source1: https://raw.githubusercontent.com/miguelgrinberg/Flask-SocketIO/v%{version}/test_socketio.py
|
||||||
BuildRequires: %{python_module setuptools}
|
|
||||||
BuildRequires: %{python_module Flask >= 0.9}
|
BuildRequires: %{python_module Flask >= 0.9}
|
||||||
BuildRequires: %{python_module python-socketio >= 5.0.2}
|
BuildRequires: %{python_module python-socketio >= 5.0.2}
|
||||||
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
Requires: python-Flask >= 0.9
|
Requires: python-Flask >= 0.9
|
||||||
Requires: python-python-socketio >= 5.0.2
|
Requires: python-python-socketio >= 5.0.2
|
||||||
@ -40,21 +42,21 @@ Socket.IO integration for Flask applications.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n Flask-SocketIO-%{version}
|
%setup -q -n Flask-SocketIO-%{version}
|
||||||
# remove coverage check from test file
|
cp %{S:1} .
|
||||||
sed -e 's/cov.stop()/pass/' -e '/cov/ d' %SOURCE1 > $(basename %SOURCE1)
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%python_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
%pyunittest -v test_socketio.py
|
%pyunittest -v test_socketio.py
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%doc LICENSE README.md
|
%doc README.md
|
||||||
|
%license LICENSE
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
import coverage
|
|
||||||
|
|
||||||
cov = coverage.coverage(branch=True)
|
|
||||||
cov.start()
|
|
||||||
|
|
||||||
from flask import Flask, session, request, json as flask_json
|
from flask import Flask, session, request, json as flask_json
|
||||||
from flask_socketio import SocketIO, send, emit, join_room, leave_room, \
|
from flask_socketio import SocketIO, send, emit, join_room, leave_room, \
|
||||||
@ -16,7 +12,9 @@ disconnected = None
|
|||||||
|
|
||||||
|
|
||||||
@socketio.on('connect')
|
@socketio.on('connect')
|
||||||
def on_connect():
|
def on_connect(auth):
|
||||||
|
if auth != {'foo': 'bar'}: # pragma: no cover
|
||||||
|
return False
|
||||||
if request.args.get('fail'):
|
if request.args.get('fail'):
|
||||||
return False
|
return False
|
||||||
send('connected')
|
send('connected')
|
||||||
@ -268,8 +266,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
cov.stop()
|
pass
|
||||||
cov.report(include='flask_socketio/*', show_missing=True)
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
pass
|
pass
|
||||||
@ -278,8 +275,8 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def test_connect(self):
|
def test_connect(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2 = socketio.test_client(app)
|
client2 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
self.assertTrue(client.is_connected())
|
self.assertTrue(client.is_connected())
|
||||||
self.assertTrue(client2.is_connected())
|
self.assertTrue(client2.is_connected())
|
||||||
self.assertNotEqual(client.eio_sid, client2.eio_sid)
|
self.assertNotEqual(client.eio_sid, client2.eio_sid)
|
||||||
@ -297,7 +294,8 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
def test_connect_query_string_and_headers(self):
|
def test_connect_query_string_and_headers(self):
|
||||||
client = socketio.test_client(
|
client = socketio.test_client(
|
||||||
app, query_string='?foo=bar&foo=baz',
|
app, query_string='?foo=bar&foo=baz',
|
||||||
headers={'Authorization': 'Bearer foobar'})
|
headers={'Authorization': 'Bearer foobar'},
|
||||||
|
auth={'foo': 'bar'})
|
||||||
received = client.get_received()
|
received = client.get_received()
|
||||||
self.assertEqual(len(received), 3)
|
self.assertEqual(len(received), 3)
|
||||||
self.assertEqual(received[0]['args'], 'connected')
|
self.assertEqual(received[0]['args'], 'connected')
|
||||||
@ -329,13 +327,14 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
client.disconnect(namespace='/test')
|
client.disconnect(namespace='/test')
|
||||||
|
|
||||||
def test_connect_rejected(self):
|
def test_connect_rejected(self):
|
||||||
client = socketio.test_client(app, query_string='fail=1')
|
client = socketio.test_client(app, query_string='fail=1',
|
||||||
|
auth={'foo': 'bar'})
|
||||||
self.assertFalse(client.is_connected())
|
self.assertFalse(client.is_connected())
|
||||||
|
|
||||||
def test_disconnect(self):
|
def test_disconnect(self):
|
||||||
global disconnected
|
global disconnected
|
||||||
disconnected = None
|
disconnected = None
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
self.assertEqual(disconnected, '/')
|
self.assertEqual(disconnected, '/')
|
||||||
|
|
||||||
@ -347,7 +346,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(disconnected, '/test')
|
self.assertEqual(disconnected, '/test')
|
||||||
|
|
||||||
def test_send(self):
|
def test_send(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
client.send('echo this message back')
|
client.send('echo this message back')
|
||||||
received = client.get_received()
|
received = client.get_received()
|
||||||
@ -355,8 +354,8 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(received[0]['args'], 'echo this message back')
|
self.assertEqual(received[0]['args'], 'echo this message back')
|
||||||
|
|
||||||
def test_send_json(self):
|
def test_send_json(self):
|
||||||
client1 = socketio.test_client(app)
|
client1 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2 = socketio.test_client(app)
|
client2 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client1.get_received()
|
client1.get_received()
|
||||||
client2.get_received()
|
client2.get_received()
|
||||||
client1.send({'a': 'b'}, json=True)
|
client1.send({'a': 'b'}, json=True)
|
||||||
@ -384,7 +383,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(received[0]['args']['a'], 'b')
|
self.assertEqual(received[0]['args']['a'], 'b')
|
||||||
|
|
||||||
def test_emit(self):
|
def test_emit(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
client.emit('my custom event', {'a': 'b'})
|
client.emit('my custom event', {'a': 'b'})
|
||||||
received = client.get_received()
|
received = client.get_received()
|
||||||
@ -394,7 +393,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(received[0]['args'][0]['a'], 'b')
|
self.assertEqual(received[0]['args'][0]['a'], 'b')
|
||||||
|
|
||||||
def test_emit_binary(self):
|
def test_emit_binary(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
client.emit('my custom event', {u'a': b'\x01\x02\x03'})
|
client.emit('my custom event', {u'a': b'\x01\x02\x03'})
|
||||||
received = client.get_received()
|
received = client.get_received()
|
||||||
@ -404,7 +403,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(received[0]['args'][0]['a'], b'\x01\x02\x03')
|
self.assertEqual(received[0]['args'][0]['a'], b'\x01\x02\x03')
|
||||||
|
|
||||||
def test_request_event_data(self):
|
def test_request_event_data(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
global request_event_data
|
global request_event_data
|
||||||
request_event_data = None
|
request_event_data = None
|
||||||
@ -427,8 +426,8 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(received[0]['args'][0]['a'], 'b')
|
self.assertEqual(received[0]['args'][0]['a'], 'b')
|
||||||
|
|
||||||
def test_broadcast(self):
|
def test_broadcast(self):
|
||||||
client1 = socketio.test_client(app)
|
client1 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2 = socketio.test_client(app)
|
client2 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client3 = socketio.test_client(app, namespace='/test')
|
client3 = socketio.test_client(app, namespace='/test')
|
||||||
client2.get_received()
|
client2.get_received()
|
||||||
client3.get_received('/test')
|
client3.get_received('/test')
|
||||||
@ -443,7 +442,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
def test_broadcast_namespace(self):
|
def test_broadcast_namespace(self):
|
||||||
client1 = socketio.test_client(app, namespace='/test')
|
client1 = socketio.test_client(app, namespace='/test')
|
||||||
client2 = socketio.test_client(app, namespace='/test')
|
client2 = socketio.test_client(app, namespace='/test')
|
||||||
client3 = socketio.test_client(app)
|
client3 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2.get_received('/test')
|
client2.get_received('/test')
|
||||||
client3.get_received()
|
client3.get_received()
|
||||||
client1.emit('my custom broadcast namespace event', {'a': 'b'},
|
client1.emit('my custom broadcast namespace event', {'a': 'b'},
|
||||||
@ -458,7 +457,8 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
def test_session(self):
|
def test_session(self):
|
||||||
flask_client = app.test_client()
|
flask_client = app.test_client()
|
||||||
flask_client.get('/session')
|
flask_client.get('/session')
|
||||||
client = socketio.test_client(app, flask_test_client=flask_client)
|
client = socketio.test_client(app, flask_test_client=flask_client,
|
||||||
|
auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
client.send('echo this message back')
|
client.send('echo this message back')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -470,8 +470,8 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
{'a': 'b', 'foo': 'bar'})
|
{'a': 'b', 'foo': 'bar'})
|
||||||
|
|
||||||
def test_room(self):
|
def test_room(self):
|
||||||
client1 = socketio.test_client(app)
|
client1 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2 = socketio.test_client(app)
|
client2 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client3 = socketio.test_client(app, namespace='/test')
|
client3 = socketio.test_client(app, namespace='/test')
|
||||||
client1.get_received()
|
client1.get_received()
|
||||||
client2.get_received()
|
client2.get_received()
|
||||||
@ -516,7 +516,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(len(received), 0)
|
self.assertEqual(len(received), 0)
|
||||||
|
|
||||||
def test_error_handling(self):
|
def test_error_handling(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
global error_testing
|
global error_testing
|
||||||
error_testing = False
|
error_testing = False
|
||||||
@ -540,9 +540,9 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertTrue(error_testing_default)
|
self.assertTrue(error_testing_default)
|
||||||
|
|
||||||
def test_ack(self):
|
def test_ack(self):
|
||||||
client1 = socketio.test_client(app)
|
client1 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2 = socketio.test_client(app)
|
client2 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client3 = socketio.test_client(app)
|
client3 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
ack = client1.send('echo this message back', callback=True)
|
ack = client1.send('echo this message back', callback=True)
|
||||||
self.assertEqual(ack, 'echo this message back')
|
self.assertEqual(ack, 'echo this message back')
|
||||||
ack = client1.send('test noackargs', callback=True)
|
ack = client1.send('test noackargs', callback=True)
|
||||||
@ -556,9 +556,9 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(ack3, {'a': 'b'})
|
self.assertEqual(ack3, {'a': 'b'})
|
||||||
|
|
||||||
def test_noack(self):
|
def test_noack(self):
|
||||||
client1 = socketio.test_client(app)
|
client1 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2 = socketio.test_client(app)
|
client2 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client3 = socketio.test_client(app)
|
client3 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
no_ack_dict = {'noackargs': True}
|
no_ack_dict = {'noackargs': True}
|
||||||
noack = client1.send("test noackargs", callback=False)
|
noack = client1.send("test noackargs", callback=False)
|
||||||
self.assertIsNone(noack)
|
self.assertIsNone(noack)
|
||||||
@ -568,7 +568,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertIsNone(noack3)
|
self.assertIsNone(noack3)
|
||||||
|
|
||||||
def test_error_handling_ack(self):
|
def test_error_handling_ack(self):
|
||||||
client1 = socketio.test_client(app)
|
client1 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client2 = socketio.test_client(app, namespace='/test')
|
client2 = socketio.test_client(app, namespace='/test')
|
||||||
client3 = socketio.test_client(app, namespace='/unused_namespace')
|
client3 = socketio.test_client(app, namespace='/unused_namespace')
|
||||||
errorack = client1.emit("error testing", "", callback=True)
|
errorack = client1.emit("error testing", "", callback=True)
|
||||||
@ -582,7 +582,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(errorack_default, 'error/default')
|
self.assertEqual(errorack_default, 'error/default')
|
||||||
|
|
||||||
def test_on_event(self):
|
def test_on_event(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
global request_event_data
|
global request_event_data
|
||||||
request_event_data = None
|
request_event_data = None
|
||||||
@ -684,13 +684,13 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertFalse(socketio.server.eio.allow_upgrades)
|
self.assertFalse(socketio.server.eio.allow_upgrades)
|
||||||
self.assertEqual(socketio.server.eio.cookie, 'foo')
|
self.assertEqual(socketio.server.eio.cookie, 'foo')
|
||||||
|
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
received = client.get_received()
|
received = client.get_received()
|
||||||
self.assertEqual(len(received), 1)
|
self.assertEqual(len(received), 1)
|
||||||
self.assertEqual(received[0]['args'], {'connected': 'foo'})
|
self.assertEqual(received[0]['args'], {'connected': 'foo'})
|
||||||
|
|
||||||
def test_encode_decode(self):
|
def test_encode_decode(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
client.get_received()
|
client.get_received()
|
||||||
data = {'foo': 'bar', 'invalid': socketio}
|
data = {'foo': 'bar', 'invalid': socketio}
|
||||||
self.assertRaises(TypeError, client.emit, 'my custom event', data,
|
self.assertRaises(TypeError, client.emit, 'my custom event', data,
|
||||||
@ -704,7 +704,7 @@ class TestSocketIO(unittest.TestCase):
|
|||||||
self.assertEqual(received[0]['args'][0], {'foo': 'bar'})
|
self.assertEqual(received[0]['args'][0], {'foo': 'bar'})
|
||||||
|
|
||||||
def test_encode_decode_2(self):
|
def test_encode_decode_2(self):
|
||||||
client = socketio.test_client(app)
|
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||||
self.assertRaises(TypeError, client.emit, 'bad response')
|
self.assertRaises(TypeError, client.emit, 'bad response')
|
||||||
self.assertRaises(TypeError, client.emit, 'bad callback',
|
self.assertRaises(TypeError, client.emit, 'bad callback',
|
||||||
callback=True)
|
callback=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user