Wykres commitów

204 Commity (main)

Autor SHA1 Wiadomość Data
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