From e259a5c747270f4a48ae03785d8b683de5e612333ba8285a3532b17b3a6d73c1 Mon Sep 17 00:00:00 2001 From: Axel Braun Date: Wed, 27 Oct 2021 17:42:15 +0000 Subject: [PATCH] Accepting request 927566 from home:DocB:branches:devel:languages:python - 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!) OBS-URL: https://build.opensuse.org/request/show/927566 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:flask/python-Flask-SocketIO?expand=0&rev=3 --- Flask-SocketIO-5.0.3.tar.gz | 3 -- Flask-SocketIO-5.1.1.tar.gz | 3 ++ python-Flask-SocketIO.changes | 16 ++++++++ python-Flask-SocketIO.spec | 18 +++++---- test_socketio.py | 72 +++++++++++++++++------------------ 5 files changed, 65 insertions(+), 47 deletions(-) delete mode 100644 Flask-SocketIO-5.0.3.tar.gz create mode 100644 Flask-SocketIO-5.1.1.tar.gz diff --git a/Flask-SocketIO-5.0.3.tar.gz b/Flask-SocketIO-5.0.3.tar.gz deleted file mode 100644 index 8680a4f..0000000 --- a/Flask-SocketIO-5.0.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4fb968c43bc384f184cd1a25c1842297c2e3d6efc2f755a61be6d4406858220f -size 15861 diff --git a/Flask-SocketIO-5.1.1.tar.gz b/Flask-SocketIO-5.1.1.tar.gz new file mode 100644 index 0000000..35210b7 --- /dev/null +++ b/Flask-SocketIO-5.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1efdaacc7a26e94f2b197a80079b1058f6aa644a6094c0a322349e2b9c41f6b1 +size 16132 diff --git a/python-Flask-SocketIO.changes b/python-Flask-SocketIO.changes index 97e4029..77bd256 100644 --- a/python-Flask-SocketIO.changes +++ b/python-Flask-SocketIO.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Sat Oct 23 15:18:45 UTC 2021 - Axel Braun + +- 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 diff --git a/python-Flask-SocketIO.spec b/python-Flask-SocketIO.spec index b9ceefd..561840c 100644 --- a/python-Flask-SocketIO.spec +++ b/python-Flask-SocketIO.spec @@ -12,22 +12,24 @@ # license that conforms to the Open Source Definition (Version 1.9) # 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-%{**}} %define skip_python2 1 Name: python-Flask-SocketIO -Version: 5.0.3 +Version: 5.1.1 Release: 0 License: MIT Summary: SocketIO integration for Flask applications -Url: http://github.com/miguelgrinberg/Flask-SocketIO/ +URL: http://github.com/miguelgrinberg/Flask-SocketIO/ Group: Development/Languages/Python 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 -BuildRequires: %{python_module setuptools} BuildRequires: %{python_module Flask >= 0.9} BuildRequires: %{python_module python-socketio >= 5.0.2} +BuildRequires: %{python_module setuptools} BuildRequires: fdupes Requires: python-Flask >= 0.9 Requires: python-python-socketio >= 5.0.2 @@ -40,21 +42,21 @@ Socket.IO integration for Flask applications. %prep %setup -q -n Flask-SocketIO-%{version} -# remove coverage check from test file -sed -e 's/cov.stop()/pass/' -e '/cov/ d' %SOURCE1 > $(basename %SOURCE1) +cp %{S:1} . %build %python_build %install -%python_install +%python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check %pyunittest -v test_socketio.py %files %{python_files} -%doc LICENSE README.md +%doc README.md +%license LICENSE %{python_sitelib}/* %changelog diff --git a/test_socketio.py b/test_socketio.py index b4d91ed..7b0ba47 100644 --- a/test_socketio.py +++ b/test_socketio.py @@ -1,9 +1,5 @@ import json import unittest -import coverage - -cov = coverage.coverage(branch=True) -cov.start() from flask import Flask, session, request, json as flask_json from flask_socketio import SocketIO, send, emit, join_room, leave_room, \ @@ -16,7 +12,9 @@ disconnected = None @socketio.on('connect') -def on_connect(): +def on_connect(auth): + if auth != {'foo': 'bar'}: # pragma: no cover + return False if request.args.get('fail'): return False send('connected') @@ -268,8 +266,7 @@ class TestSocketIO(unittest.TestCase): @classmethod def tearDownClass(cls): - cov.stop() - cov.report(include='flask_socketio/*', show_missing=True) + pass def setUp(self): pass @@ -278,8 +275,8 @@ class TestSocketIO(unittest.TestCase): pass def test_connect(self): - client = socketio.test_client(app) - client2 = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) + client2 = socketio.test_client(app, auth={'foo': 'bar'}) self.assertTrue(client.is_connected()) self.assertTrue(client2.is_connected()) self.assertNotEqual(client.eio_sid, client2.eio_sid) @@ -297,7 +294,8 @@ class TestSocketIO(unittest.TestCase): def test_connect_query_string_and_headers(self): client = socketio.test_client( app, query_string='?foo=bar&foo=baz', - headers={'Authorization': 'Bearer foobar'}) + headers={'Authorization': 'Bearer foobar'}, + auth={'foo': 'bar'}) received = client.get_received() self.assertEqual(len(received), 3) self.assertEqual(received[0]['args'], 'connected') @@ -329,13 +327,14 @@ class TestSocketIO(unittest.TestCase): client.disconnect(namespace='/test') 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()) def test_disconnect(self): global disconnected disconnected = None - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.disconnect() self.assertEqual(disconnected, '/') @@ -347,7 +346,7 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(disconnected, '/test') def test_send(self): - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.get_received() client.send('echo this message back') received = client.get_received() @@ -355,8 +354,8 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(received[0]['args'], 'echo this message back') def test_send_json(self): - client1 = socketio.test_client(app) - client2 = socketio.test_client(app) + client1 = socketio.test_client(app, auth={'foo': 'bar'}) + client2 = socketio.test_client(app, auth={'foo': 'bar'}) client1.get_received() client2.get_received() client1.send({'a': 'b'}, json=True) @@ -384,7 +383,7 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(received[0]['args']['a'], 'b') def test_emit(self): - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.get_received() client.emit('my custom event', {'a': 'b'}) received = client.get_received() @@ -394,7 +393,7 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(received[0]['args'][0]['a'], 'b') def test_emit_binary(self): - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.get_received() client.emit('my custom event', {u'a': b'\x01\x02\x03'}) received = client.get_received() @@ -404,7 +403,7 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(received[0]['args'][0]['a'], b'\x01\x02\x03') def test_request_event_data(self): - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.get_received() global request_event_data request_event_data = None @@ -427,8 +426,8 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(received[0]['args'][0]['a'], 'b') def test_broadcast(self): - client1 = socketio.test_client(app) - client2 = socketio.test_client(app) + client1 = socketio.test_client(app, auth={'foo': 'bar'}) + client2 = socketio.test_client(app, auth={'foo': 'bar'}) client3 = socketio.test_client(app, namespace='/test') client2.get_received() client3.get_received('/test') @@ -443,7 +442,7 @@ class TestSocketIO(unittest.TestCase): def test_broadcast_namespace(self): client1 = 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') client3.get_received() client1.emit('my custom broadcast namespace event', {'a': 'b'}, @@ -458,7 +457,8 @@ class TestSocketIO(unittest.TestCase): def test_session(self): flask_client = app.test_client() 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.send('echo this message back') self.assertEqual( @@ -470,8 +470,8 @@ class TestSocketIO(unittest.TestCase): {'a': 'b', 'foo': 'bar'}) def test_room(self): - client1 = socketio.test_client(app) - client2 = socketio.test_client(app) + client1 = socketio.test_client(app, auth={'foo': 'bar'}) + client2 = socketio.test_client(app, auth={'foo': 'bar'}) client3 = socketio.test_client(app, namespace='/test') client1.get_received() client2.get_received() @@ -516,7 +516,7 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(len(received), 0) def test_error_handling(self): - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.get_received() global error_testing error_testing = False @@ -540,9 +540,9 @@ class TestSocketIO(unittest.TestCase): self.assertTrue(error_testing_default) def test_ack(self): - client1 = socketio.test_client(app) - client2 = socketio.test_client(app) - client3 = socketio.test_client(app) + client1 = socketio.test_client(app, auth={'foo': 'bar'}) + client2 = socketio.test_client(app, auth={'foo': 'bar'}) + client3 = socketio.test_client(app, auth={'foo': 'bar'}) ack = client1.send('echo this message back', callback=True) self.assertEqual(ack, 'echo this message back') ack = client1.send('test noackargs', callback=True) @@ -556,9 +556,9 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(ack3, {'a': 'b'}) def test_noack(self): - client1 = socketio.test_client(app) - client2 = socketio.test_client(app) - client3 = socketio.test_client(app) + client1 = socketio.test_client(app, auth={'foo': 'bar'}) + client2 = socketio.test_client(app, auth={'foo': 'bar'}) + client3 = socketio.test_client(app, auth={'foo': 'bar'}) no_ack_dict = {'noackargs': True} noack = client1.send("test noackargs", callback=False) self.assertIsNone(noack) @@ -568,7 +568,7 @@ class TestSocketIO(unittest.TestCase): self.assertIsNone(noack3) 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') client3 = socketio.test_client(app, namespace='/unused_namespace') errorack = client1.emit("error testing", "", callback=True) @@ -582,7 +582,7 @@ class TestSocketIO(unittest.TestCase): self.assertEqual(errorack_default, 'error/default') def test_on_event(self): - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.get_received() global request_event_data request_event_data = None @@ -684,13 +684,13 @@ class TestSocketIO(unittest.TestCase): self.assertFalse(socketio.server.eio.allow_upgrades) self.assertEqual(socketio.server.eio.cookie, 'foo') - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) received = client.get_received() self.assertEqual(len(received), 1) self.assertEqual(received[0]['args'], {'connected': 'foo'}) def test_encode_decode(self): - client = socketio.test_client(app) + client = socketio.test_client(app, auth={'foo': 'bar'}) client.get_received() data = {'foo': 'bar', 'invalid': socketio} 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'}) 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 callback', callback=True)