parent
75a0b57eea
commit
370b7e3e18
3 changed files with 15 additions and 1 deletions
|
@ -5,7 +5,7 @@ if [ $version ]
|
||||||
then
|
then
|
||||||
versions=("$version")
|
versions=("$version")
|
||||||
else
|
else
|
||||||
versions=(1.23.1 1.23.0 1.22.1 1.22.0 1.21.3)
|
versions=(1.23.2 1.23.0 1.22.1 1.22.0 1.21.3)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for version in ${versions[*]}
|
for version in ${versions[*]}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from uptime_kuma_api import UptimeKumaApi
|
||||||
from uptime_kuma_test_case import UptimeKumaTestCase
|
from uptime_kuma_test_case import UptimeKumaTestCase
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +10,16 @@ class TestInfo(UptimeKumaTestCase):
|
||||||
self.assertIn("version", info)
|
self.assertIn("version", info)
|
||||||
self.assertIn("latestVersion", info)
|
self.assertIn("latestVersion", info)
|
||||||
|
|
||||||
|
def test_info_with_version(self):
|
||||||
|
# If wait_events is set to 0, the first info event is normally used.
|
||||||
|
# The info event handler needs to drop this first event without a version.
|
||||||
|
self.api.logout()
|
||||||
|
self.api.disconnect()
|
||||||
|
self.api = UptimeKumaApi(self.url, wait_events=0)
|
||||||
|
self.api.login(self.username, self.password)
|
||||||
|
info = self.api.info()
|
||||||
|
self.assertIn("version", info)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -626,6 +626,9 @@ class UptimeKumaApi(object):
|
||||||
self._event_data[Event.IMPORTANT_HEARTBEAT_LIST][monitor_id] = [data] + self._event_data[Event.IMPORTANT_HEARTBEAT_LIST][monitor_id]
|
self._event_data[Event.IMPORTANT_HEARTBEAT_LIST][monitor_id] = [data] + self._event_data[Event.IMPORTANT_HEARTBEAT_LIST][monitor_id]
|
||||||
|
|
||||||
def _event_info(self, data) -> None:
|
def _event_info(self, data) -> None:
|
||||||
|
if "version" not in data:
|
||||||
|
# wait for the info event that is sent after login and contains the version
|
||||||
|
return
|
||||||
self._event_data[Event.INFO] = data
|
self._event_data[Event.INFO] = data
|
||||||
|
|
||||||
def _event_cert_info(self, monitor_id, data) -> None:
|
def _event_cert_info(self, monitor_id, data) -> None:
|
||||||
|
|
Loading…
Reference in a new issue