Wykres commitów

330 Commity (config_dataclasses)

Autor SHA1 Wiadomość Data
Andrew Mirsky 371e76fb30
adding test to cover adapter base classes. adding test for BrokerSysPlugin 2025-06-01 11:09:40 -04:00
Andrew Mirsky f439f6fb7d
fixing test case to align with additional warning method 2025-05-31 17:11:16 -04:00
Andrew Mirsky 7f60d8d399
Merge branch 'rc' into test_paho 2025-05-31 12:06:06 -04:00
Andrew Mirsky 1e1e2026d3
cleaning up plugin interface and documentation 2025-05-30 18:50:31 -04:00
Andrew Mirsky 4701ba3faa
disabling rich output for script help 2025-05-30 12:21:15 -04:00
Andrew Mirsky 44dfd58972
disabling rich output to verify usage message is generated correctly 2025-05-30 12:11:47 -04:00
Andrew Mirsky 8f9e8afb63
clean up of the command line docs, caused inconsistent behavior between pub and sub script. limiting to mypy 1.15, since newer version has breaking changes 2025-05-29 16:29:05 -04:00
Andrew Mirsky 97436e5dcd
resolve #170. add tests to verify compatibility with paho-mqtt library 2025-05-26 16:49:57 -04:00
Andrew Mirsky ec31def92c
enhancing the 'test_init_handler' case so that it checks to make sure that the ProtocolHandler defaults to the correct loop. 2025-05-26 10:46:11 -04:00
Andrew Mirsky 5c5305baa6
while the explicit close to the asyncio.open_server docs say that you need to close the writer to have it properly exit, it seems that only python 3.12 requires the explicit close 2025-05-26 09:03:51 -04:00
Andrew Mirsky a7f2ae5746
test_init_handler: protocolhandler gets the current loop, if not provided and self.loop isn't the current loop, it's a new loop; ProtocolHandler.__init__: handler was using the session's keepalive, even though if the keepalive is zero, it needs to bypass 2025-05-26 08:48:10 -04:00
Andrew Mirsky 255e38a947
adding debug statements to determine root cause of qos failures 2025-05-25 12:44:54 -04:00
Andrew Mirsky 6afe0cddbb
disabling color output 2025-05-20 12:43:39 -04:00
Andrew Mirsky 82fe0f0ca1
disable colorized cli output for test_cli 2025-05-20 12:38:17 -04:00
Andrew Mirsky 0a50ff02ce
use 'Self' from typing_extensions to support python 3.10. add cli checks for publisher for required 'will' options. update cli test for pub/sub retain 2025-05-20 12:26:22 -04:00
Andrew Mirsky 0401220c38
turn cli exceptions into error message and error codes. added cli tests 2025-05-19 14:23:51 -04:00
Andrew Mirsky 1f2f7a1f79
since the amqtt broker (and MQTT 3.1) requires that that a CONNECT packet be received for a valid socket connection, need to send one (See BrokerProtocolHandler.init_from_connect) otherewise, the connection is immediately closed. asyncio's behavior in python 3.10, 3.11 & 3.13 seems to defer processing the 'read_or_raise' from the socket. however, python 3.12 prioritizes the 'read_or_raise' in the loop so it, triggers a NoDataError, terminating the socket before we can verify in the test. 2025-05-19 12:45:45 -04:00
MVladislav 12d5cb6866 refactor: modularize broker listener startup and improve session management
- Extracted listener startup logic into a separate method `_start_listeners` for better readability and maintainability.
- Created helper methods for SSL context creation.
- Improved session cleanup during shutdown by centralizing logic in `_cleanup_session`.
- Refactored message handling and subscription management into dedicated methods for clarity.
- Updated tests to reflect changes in method visibility for matching topics.
2025-04-06 19:03:30 +02:00
MVladislav 338ff39b17 chore: update version to 0.11.0-beta4, add clear_queues method, and improve resource management in PluginManager and BrokerProtocolHandler 2025-04-04 19:18:17 +02:00
MVladislav 0afe361bd0 fix(#0): renaming file and fix usage
- logging was renamed as logging_a now better as logging_amqtt with fix inside pyproject.toml
- renamed codecs => codecs_a => codecs_amqtt
2025-01-16 20:01:16 +01:00
MVladislav 57bfec0ea8 refactor: more cleanup/linting especial Pylint 2025-01-12 22:44:19 +01:00
MVladislav 40d1214c79 refactor: checking open pull requests:
- #119 :: not working in test cases, only comment
- #153 :: updated
- #61 :: removed try block as described
- #72 :: function included
2025-01-12 21:28:42 +01:00
MVladislav a024b174d0 refactor: more cleanup/linting 2025-01-12 20:52:50 +01:00
MVladislav 1a72fa8e39 refactor: formatting 2024-12-29 19:23:27 +01:00
MVladislav 7c001d69b2 refactor: bigger code upgrade and improves
- add github workflows
- update project.toml by disable multi parts to not see every needed fix now
- improve tests cases
- improve code quality
- ...
2024-12-21 11:52:26 +01:00
MVladislav 7cc746e483 refactor: base cleanup and bring project to run with test cases 2024-12-19 20:34:09 +01:00
rparry-jones d0eb64dc19 #126
- Updated protocol handlers to more reliably remove active waiters when task cancellation occurs
- Fixed checks where expecting a KeyError when it should be checking if not None
- Updated next_packet_id property to correctly check if there are any packet_ids available. Avoids infinite loop if all packet ids are used.
2023-02-27 18:52:11 +01:00
Marius Kriegerowski 7fcdb0c13b broker: release server connection upon exception 2023-02-11 15:53:13 +01:00
Marius Kriegerowski 4944b0deae unit testing tcp connection to the broker 2023-02-11 15:53:06 +01:00
Fabian Elsner 96e89fb37f Fix test for Python 3.7 2023-02-09 12:42:48 +01:00
Fabian Elsner 604c45ca7a Added test for broadcast loop cancellation 2023-02-09 12:42:48 +01:00
Rémi Cardona a3f982c4d2 allow connections with username only
Section [MQTT-3.1.2-22] of the MQTT 3.1.1 only says that a password cannot be
given without a user. The reverse should be allowed. Fixes #79.
2022-04-17 12:05:25 +02:00
Florian Ludwig ecf64a4f82 python pre 3.9 compatibily 2022-02-06 14:42:51 +01:00
Florian Ludwig 42be5c145c reformat with black 2022-02-06 14:42:51 +01:00
Robert Resch 1bc2e06be2 fix flake8 error 2022-02-06 14:42:51 +01:00
Robert Resch 5181289d2b improve has_attr plugin tests 2022-02-06 14:42:51 +01:00
Florian Ludwig d43b36f90c throw exception instance not class and add test 2022-02-06 14:42:51 +01:00
Florian Ludwig 9628a1ce3e remove deprecated loop parameter from tests 2022-01-11 12:55:04 +01:00
Florian Ludwig 4beb912c2a remove legacy cli test 2021-08-17 17:01:58 +02:00
Florian Ludwig 86cec6d2a5 remove hbmqtt plugin namespace compatibility 2021-08-17 17:01:58 +02:00
Stuart Longland 5315e2d865 broker tests: Fix reference to TimeoutError.
Seems Python 3.8+ moved it, and I took the reference from there.
2021-08-17 16:20:27 +02:00
Stuart Longland 3b793a706b broker tests: Clean up flake8 warnings 2021-08-17 16:20:27 +02:00
Stuart Longland fed6d2c31c plugins.topic_checking tests: Fix issues identified by flake8 2021-08-17 16:20:27 +02:00
Stuart Longland bf5279911b Pass code through `black` formatter 2021-08-17 16:20:27 +02:00
Stuart Longland 29854264e3 broker tests: Change passwords for user[1…3]
As pointed out, it's possible to accidentally mix them up if the
passwords are the same.  Obviously, the passwords used for these tests
should _NOT_ be used in production.
2021-08-17 16:20:27 +02:00
Stuart Longland 744a6868fe plugins.topic_checking: De-indent logging checks
As pointed out, the `logdog` docs do the checks outside of the context
manager scope, so we should do so as well.
2021-08-17 16:20:27 +02:00
Stuart Longland 2e52b22c2c plugins.topic_checking tests: Run code formatting tool. 2021-08-17 16:20:27 +02:00
Stuart Longland 0760bd7613 plugins.topic_checking tests: Replace DummyLogger with `logdog` plug-in. 2021-08-17 16:20:27 +02:00
Stuart Longland 5ad48d9129 test config: Enable `pytest_logdog` plug-in 2021-08-17 16:20:27 +02:00
Stuart Longland 73db6a3536 plugins.topic_checking tests: Fix tests broken by Enum change. 2021-08-17 16:20:27 +02:00
Stuart Longland 100ca6e67a plugins.topic_checking tests: Clean up `assert`/`await` calls 2021-08-17 16:20:27 +02:00
Stuart Longland b33fb05991 plugins.topic_checking tests: Add tests for enabled=False 2021-08-17 16:20:27 +02:00
Stuart Longland db5e886c7e broker tests: Add system test for publish authorisation 2021-08-17 16:20:27 +02:00
Stuart Longland 653b6cd89c plugins.topic_checking tests: Drop copyright header 2021-08-17 16:20:27 +02:00
Stuart Longland 9efd152c1b plugins.topic_checking tests: Fix comment statement 2021-08-17 16:20:27 +02:00
Stuart Longland 33531c2f23 test cases: Add fixture for ACL-enabled test server
This uses the real plug-ins to test the broker correctly responds to the
return values when publishing and subscribing.

The plug-ins themselves are tested elsewhere.
2021-08-17 16:20:27 +02:00
Stuart Longland f30aa9245d test password file: Add some more users 2021-08-17 16:20:27 +02:00
Stuart Longland 66568122c5 plugin.topic_checking tests: Fix code formatting.
Yes, too lazy to hold down shift when hitting the `'` key.
2021-08-17 16:20:27 +02:00
Stuart Longland 18cf5cdd1e plugins.topic_checking: Add remaining tests. 2021-08-17 16:20:27 +02:00
Stuart Longland 8daf173a75 plugins.topic_checking: Test topic_ac static method 2021-08-17 16:20:27 +02:00
Stuart Longland 480a944282 plugins.topic_checking tests: Throw test suite at `black`.
Clean up the coding style a bit.
2021-08-17 16:20:27 +02:00
Stuart Longland 0cfce9fd84 plugins.test_topic tests: Add tests for TopicTabooPlugin.
This is more of a "demo" plug-in, but let's test it anyway.
2021-08-17 16:20:27 +02:00
Stuart Longland 75b8c33263 plugins.topic_checking tests: Test BaseTopicPlugin. 2021-08-17 16:20:27 +02:00
Marius Kriegerowski f1ac274457 add test_utils 2021-05-03 21:42:19 +02:00
Florian Ludwig 9a1c6643be add smoketest for CLI 2021-04-05 19:11:00 +02:00
Florian Ludwig 478a2d18c8 entrypoint transition code 2021-03-27 17:49:55 +01:00
Florian Ludwig e1c73fc53a update imports in tests 2021-03-27 17:49:55 +01:00
Florian Ludwig 8237912a3b re-enable plugin manager tests 2021-03-21 19:02:02 +01:00
Florian Ludwig 69a7992b66 rename TestPlugin to so it is ignored by pytest 2021-03-21 19:02:02 +01:00
Marius Kriegerowski 613e77f6b4 more strict flake8. Fixed typos. 2021-03-17 10:57:32 +01:00
lrasku c41b01499d Fix topic filter matching
- re.escape() the whole filter string first to escape _all_ regex
  metacharacters in it, not just $. (# and + are both regex metacharacters,
  so their replace expressions now need a leading \\ to replace the
  escaping, too.)
- # matches topics both with and without a trailing /, so the replace
  expressions adds a '?' before the '.*'. The .lstrip('?') at the end removes
  this in case the # was the first character in the filter.
- + should only match a single level, but it should _also_ match empty levels,
  so use '[^/]*' to replace it.
- Use Regex.fullmatch() to match against the whole topic string, not just
  its start.

Also add two unit tests to test this matching, and fix an incorrect match
against + in test_client_subscribe_publish_dollar_topic_2.
2021-03-15 13:43:47 +01:00
Marius Kriegerowski 7921e2cc22 linter project with black at default line length 88 2021-03-15 10:18:00 +01:00
Marius Kriegerowski db3dffa857 use black linter with 96 char line length 2021-03-14 21:44:41 +01:00
Florian Ludwig f439ccd1b1 reaplce some more assertEqual 2021-03-09 19:13:32 +01:00
Florian Ludwig 7c56c9caba migrate test_client to pytest 2021-03-09 19:13:32 +01:00
Florian Ludwig 7276075ed8 move broker into pytest fixture 2021-03-09 19:13:32 +01:00
Florian Ludwig b430cc8487 replace assertTrue 2021-03-09 19:13:32 +01:00
Florian Ludwig 5c58fcd59c rework broker tests to use pytest-asyncio 2021-03-09 19:13:32 +01:00
Marius Kriegerowski 6f586c253c Fix missing plugin property 2021-03-09 19:13:32 +01:00
Marius Kriegerowski 080a358dd7 Patch MagicMock to asyncronize 2021-03-09 19:13:32 +01:00
Marius Kriegerowski e0fabc0bc3 Refactor to comply python3.8 2021-03-09 19:13:32 +01:00
Florian Ludwig bd58685028 mark failing tasts as allowed to fail 2021-03-08 21:08:35 +01:00
Marius Kriegerowski aeee26f34b Download mosquitto certificate on the fly 2021-03-01 17:40:57 +01:00
Thinh Nguyen 5a241d7739 Only setting session username/password if it is not already set. This is to prevent failures when the broker is reconnecting without username/password 2018-10-29 13:55:09 +11:00
Guillaume Desvé 31888f8e69 python3.7 support 2018-06-29 15:56:27 +02:00
mi3z 465b2cfc42 changed localhost to 127.0.0.1 to fix Travis CI test 2017-11-17 10:11:26 +01:00
mi3z 3b9362c75d
fixed test_decode_fail_miss_clientId 2017-11-14 19:32:29 +01:00
mi3z 3fc4bb7a9e
fixed port for test_connect_ws
fixed port used for ws test from 8081 (which is wss) to 8080.
2017-11-09 17:32:07 +01:00
Stein Magnus Jodal ce4824bf70 flake8: Fix all F841 unused local variable warnings 2017-08-07 01:23:21 +02:00
Stein Magnus Jodal 559c18f681 flake8: Fix all F403, F405, F821 import warnings 2017-08-07 01:23:21 +02:00
Stein Magnus Jodal 6435e4239c flake8: Fix all F401 unused imports warnings 2017-08-07 01:23:21 +02:00
Stein Magnus Jodal 177bfb627c flake8: Fix all E1xx indentation warnings 2017-08-07 01:23:21 +02:00
Stein Magnus Jodal ed676945b4 flake8: Fix all Wxxx whitespace and newline warnings 2017-08-07 01:23:21 +02:00
Stein Magnus Jodal df2c9b8a43 flake8: Fix all E3xx newline warnings 2017-08-07 01:23:20 +02:00
Stein Magnus Jodal 6f4b306886 flake8: Fix all E2xx whitespace warnings 2017-08-07 01:23:20 +02:00
Stein Magnus Jodal 8b1aa60587 Change deprecated assertEquals() to assertEqual() 2017-07-26 14:06:13 +02:00
Nicolas 2c1db79127 Fix #75.
Reset packet_id when > 65535.
This may lead to performance problem when there are still many in-flight messages (QOS1 or QOS 2 not yet acknowledged)
2017-06-02 21:17:05 +02:00
Nicolas d382ada36b Update websockets, use local broker for testing 2017-06-02 16:53:58 +02:00
Nicolas b7401443c8 Fix #40 and add test cases 2016-05-31 21:40:10 +02:00
Nicolas 89ea06246b #33
Added test case
2016-05-04 22:55:19 +02:00
Nicolas f298a4a543 Fix #35
Test retain message exists before trying to delete it.
2016-05-04 22:43:06 +02:00
Nicolas 0e11d545d8 Fix #23
+ add test case
2016-05-04 22:35:38 +02:00
Nicolas e9b806348e Fix #32 2016-04-10 23:02:10 +02:00
Nicolas ea62725868 Fix #30 2016-04-10 22:32:07 +02:00
Nicolas 5dc5293063 Fix #25 #26 2016-04-10 22:15:17 +02:00
Nicolas 360d5b03c7 Fix #28 2016-04-10 22:06:33 +02:00
Nicolas 7a868bd66e Fix issue #24
Data was not read correctly until the end of the buffer
2016-04-10 15:33:48 +02:00
Nico dd1a5bde6a Randomize packet ID 2015-11-01 21:55:24 +01:00
Nico 4dcf8eb477 Revert to 3.4 coroutine syntax 2015-11-01 15:58:20 +01:00
Nico 52e3160995 #HBMQTT-35
Refactor yield from -> await
2015-10-16 22:13:37 +02:00
Nico 6a876be559 Improve perf 2015-10-15 21:57:21 +02:00
Nico 7ede67ed7e Performance 2015-10-14 22:58:18 +02:00
Nico c3a144c6a3 All tests passing 2015-10-12 21:33:14 +02:00
Nico a3d856b4c8 fixes + add tests 2015-10-10 22:25:31 +02:00
Nico 6b7b962b16 Add publish retain test 2015-10-10 15:01:17 +02:00
Nico a456d9cf21 Fix QOS flag init + add tests 2015-10-10 14:42:49 +02:00
Nico 10a0ef797b Add unsubscribe test
Add subscribe twice on same topic test
2015-10-08 22:38:32 +02:00
Nico c0190fafeb Add subscription test 2015-10-08 22:09:34 +02:00
Nico d0491a92ef add test assertions 2015-10-08 21:25:15 +02:00
Nico 3acec1d606 Add broker test class + fixes in both client and broker connection management 2015-10-07 22:42:04 +02:00
Nico 2e1cc52164 Add plugin calls assertions on broker start/shutdown 2015-09-30 22:41:39 +02:00
Nico 04c0b257c4 Remove unused 2015-09-30 22:09:25 +02:00
Nico d270a34b28 Basic broker test 2015-09-30 21:34:21 +02:00
Nico fb760e6858 Add missing 'from' 2015-09-30 21:33:42 +02:00
Nico a4e002de2a Add publish message retry on start() 2015-09-30 21:22:46 +02:00
Nico 7f95194fdc Fix handler testing 2015-09-29 22:28:05 +02:00
Nico a8b5fb221d remove ugly print() 2015-09-29 22:05:09 +02:00
Nico 05a61581fe add subscribe/unsubscribe tests 2015-09-27 22:07:09 +02:00
Nico fec006d830 Add secure CA 2015-09-27 21:39:43 +02:00
Nico 92a456b789 Add client tests 2015-09-27 21:17:42 +02:00
Nico 01628e25a6 Fix port init. 2015-09-27 21:16:55 +02:00
Nico a256a79bb5 Add test assertions 2015-09-23 21:18:09 +02:00
Nico 7fb4fb92da Fix tests (was not using the same loop) 2015-09-22 22:44:29 +02:00
Nico c05aee5468 Fix tests except QOS2 receive 2015-09-21 23:05:35 +02:00
Nico ec835667c0 Skip receive tests 2015-09-16 23:12:50 +02:00
Nico 23a95724ef Clean 2015-09-16 22:18:06 +02:00
Nico eb9defa5cc try a fix for blocking methods. 2015-09-15 23:38:24 +02:00
Nico 417bb01148 Receive messages FIX 2015-09-15 23:17:55 +02:00
Nico 4b7be2b879 Add QOS1 message test and fix 2015-09-15 21:47:42 +02:00
Nico 2d5d1c3d45 Add and fix QOS_0 message receive 2015-09-15 21:31:07 +02:00
Nico dace44a491 Add QOS_2 publish test 2015-09-14 22:56:22 +02:00
Nico 484c445f12 Add QOS_1 publish testing 2015-09-14 22:31:16 +02:00
Nico 27bb4982d7 Add assertions 2015-09-14 22:08:14 +02:00
Nico d4549c4349 generalize AssertionError set into future 2015-09-14 21:55:55 +02:00
Nico 3a52798e3e Add QOS_0 publish test 2015-09-14 21:18:08 +02:00
Nico 2c60b3c1a0 Commit with test failure 2015-09-13 22:36:22 +02:00
Nico 52c3b83704 Add start/stop test 2015-09-12 15:28:40 +02:00
Nicolas Jouanin 2cb5a7d9dc Add init test 2015-09-12 14:47:36 +02:00
Nicolas Jouanin 98b26734b7 Add coveralls 2015-09-12 14:23:30 +02:00
Nicolas Jouanin b1caea4d6a Comment test to be done 2015-09-03 21:33:37 +02:00