Accepting request 1094493 from devel:languages:python:flask
- Clean up SPEC file, make rpmlint happy. - update to version 5.3.4 * For a full changelog see https://github.com/miguelgrinberg/Flask-SocketIO/blob/main/CHANGES.md OBS-URL: https://build.opensuse.org/request/show/1094493 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Flask-SocketIO?expand=0&rev=3
This commit is contained in:
commit
9562c7fb70
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1efdaacc7a26e94f2b197a80079b1058f6aa644a6094c0a322349e2b9c41f6b1
|
||||
size 16132
|
3
Flask-SocketIO-5.3.4.tar.gz
Normal file
3
Flask-SocketIO-5.3.4.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1cbd379c9bf68ac37bcc4750d01708922fa6365d13a5447d3f8893792879410c
|
||||
size 17109
|
@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 21 21:36:05 UTC 2023 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Clean up SPEC file, make rpmlint happy.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 21 19:56:26 UTC 2023 - Axel Braun <axel.braun@gmx.de>
|
||||
|
||||
- update to version 5.3.4
|
||||
* For a full changelog see https://github.com/miguelgrinberg/Flask-SocketIO/blob/main/CHANGES.md
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 23 15:18:45 UTC 2021 - Axel Braun <axel.braun@gmx.de>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-Flask-SocketIO
|
||||
#
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -16,24 +16,24 @@
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python3-%{**}}
|
||||
%define skip_python2 1
|
||||
Name: python-Flask-SocketIO
|
||||
Version: 5.1.1
|
||||
Version: 5.3.4
|
||||
Release: 0
|
||||
License: MIT
|
||||
Summary: SocketIO integration for Flask applications
|
||||
URL: http://github.com/miguelgrinberg/Flask-SocketIO/
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/miguelgrinberg/Flask-SocketIO/
|
||||
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 Flask >= 0.9}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module python-socketio >= 5.0.2}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module redis}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
Requires: python-Flask >= 0.9
|
||||
Requires: python-python-socketio >= 5.0.2
|
||||
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
@ -42,21 +42,22 @@ Socket.IO integration for Flask applications.
|
||||
|
||||
%prep
|
||||
%setup -q -n Flask-SocketIO-%{version}
|
||||
cp %{S:1} .
|
||||
cp %{SOURCE1} .
|
||||
|
||||
%build
|
||||
%python_build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pyunittest -v test_socketio.py
|
||||
|
||||
%files %{python_files}
|
||||
%files %{python_files}
|
||||
%doc README.md
|
||||
%license LICENSE
|
||||
%{python_sitelib}/*
|
||||
%{python_sitelib}/flask_socketio
|
||||
%{python_sitelib}/Flask_SocketIO-%{version}*-info
|
||||
|
||||
%changelog
|
||||
|
@ -3,7 +3,7 @@ import unittest
|
||||
|
||||
from flask import Flask, session, request, json as flask_json
|
||||
from flask_socketio import SocketIO, send, emit, join_room, leave_room, \
|
||||
Namespace, disconnect
|
||||
Namespace, disconnect, ConnectionRefusedError
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'secret'
|
||||
@ -16,11 +16,12 @@ def on_connect(auth):
|
||||
if auth != {'foo': 'bar'}: # pragma: no cover
|
||||
return False
|
||||
if request.args.get('fail'):
|
||||
return False
|
||||
raise ConnectionRefusedError('failed!')
|
||||
send('connected')
|
||||
send(json.dumps(request.args.to_dict(flat=False)))
|
||||
send(json.dumps({h: request.headers[h] for h in request.headers.keys()
|
||||
if h not in ['Host', 'Content-Type', 'Content-Length']}))
|
||||
emit('dummy', to='nobody')
|
||||
|
||||
|
||||
@socketio.on('disconnect')
|
||||
@ -47,7 +48,12 @@ def on_disconnect_test():
|
||||
def message(message):
|
||||
send(message)
|
||||
if message == 'test session':
|
||||
session['a'] = 'b'
|
||||
if not socketio.manage_session and 'a' in session:
|
||||
raise RuntimeError('session is being stored')
|
||||
if 'a' not in session:
|
||||
session['a'] = 'b'
|
||||
else:
|
||||
session['a'] = 'c'
|
||||
if message not in "test noackargs":
|
||||
return message
|
||||
|
||||
@ -345,6 +351,25 @@ class TestSocketIO(unittest.TestCase):
|
||||
client.disconnect('/test')
|
||||
self.assertEqual(disconnected, '/test')
|
||||
|
||||
def test_message_queue_options(self):
|
||||
app = Flask(__name__)
|
||||
socketio = SocketIO(app, message_queue='redis://')
|
||||
self.assertFalse(socketio.server_options['client_manager'].write_only)
|
||||
|
||||
app = Flask(__name__)
|
||||
socketio = SocketIO(app)
|
||||
socketio.init_app(app, message_queue='redis://')
|
||||
self.assertFalse(socketio.server_options['client_manager'].write_only)
|
||||
|
||||
app = Flask(__name__)
|
||||
socketio = SocketIO(message_queue='redis://')
|
||||
self.assertTrue(socketio.server_options['client_manager'].write_only)
|
||||
|
||||
app = Flask(__name__)
|
||||
socketio = SocketIO()
|
||||
socketio.init_app(None, message_queue='redis://')
|
||||
self.assertTrue(socketio.server_options['client_manager'].write_only)
|
||||
|
||||
def test_send(self):
|
||||
client = socketio.test_client(app, auth={'foo': 'bar'})
|
||||
client.get_received()
|
||||
@ -454,7 +479,7 @@ class TestSocketIO(unittest.TestCase):
|
||||
self.assertEqual(received[0]['args'][0]['a'], 'b')
|
||||
self.assertEqual(len(client3.get_received()), 0)
|
||||
|
||||
def test_session(self):
|
||||
def test_managed_session(self):
|
||||
flask_client = app.test_client()
|
||||
flask_client.get('/session')
|
||||
client = socketio.test_client(app, flask_test_client=flask_client,
|
||||
@ -468,6 +493,21 @@ class TestSocketIO(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
socketio.server.environ[client.eio_sid]['saved_session'],
|
||||
{'a': 'b', 'foo': 'bar'})
|
||||
client.send('test session')
|
||||
self.assertEqual(
|
||||
socketio.server.environ[client.eio_sid]['saved_session'],
|
||||
{'a': 'c', 'foo': 'bar'})
|
||||
|
||||
def test_unmanaged_session(self):
|
||||
socketio.manage_session = False
|
||||
flask_client = app.test_client()
|
||||
flask_client.get('/session')
|
||||
client = socketio.test_client(app, flask_test_client=flask_client,
|
||||
auth={'foo': 'bar'})
|
||||
client.get_received()
|
||||
client.send('test session')
|
||||
client.send('test session')
|
||||
socketio.manage_session = True
|
||||
|
||||
def test_room(self):
|
||||
client1 = socketio.test_client(app, auth={'foo': 'bar'})
|
||||
@ -647,11 +687,18 @@ class TestSocketIO(unittest.TestCase):
|
||||
|
||||
def test_server_disconnected(self):
|
||||
client = socketio.test_client(app, namespace='/ns')
|
||||
client2 = socketio.test_client(app, namespace='/ns')
|
||||
client.get_received('/ns')
|
||||
client2.get_received('/ns')
|
||||
client.emit('exit', {}, namespace='/ns')
|
||||
self.assertFalse(client.is_connected('/ns'))
|
||||
self.assertTrue(client2.is_connected('/ns'))
|
||||
with self.assertRaises(RuntimeError):
|
||||
client.emit('hello', {}, namespace='/ns')
|
||||
client2.emit('exit', {}, namespace='/ns')
|
||||
self.assertFalse(client2.is_connected('/ns'))
|
||||
with self.assertRaises(RuntimeError):
|
||||
client2.emit('hello', {}, namespace='/ns')
|
||||
|
||||
def test_emit_class_based(self):
|
||||
client = socketio.test_client(app, namespace='/ns')
|
||||
|
Loading…
Reference in New Issue
Block a user