add missing session_stats_header_alert in python binding
This commit is contained in:
parent
a8cf790833
commit
abbbcf52c1
|
@ -954,6 +954,10 @@ void bind_alert()
|
||||||
.add_property("values", &session_stats_values)
|
.add_property("values", &session_stats_values)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
class_<session_stats_header_alert, bases<alert>, noncopyable>(
|
||||||
|
"session_stats_header_alert", no_init)
|
||||||
|
;
|
||||||
|
|
||||||
std::vector<tcp::endpoint> (dht_get_peers_reply_alert::*peers)() const = &dht_get_peers_reply_alert::peers;
|
std::vector<tcp::endpoint> (dht_get_peers_reply_alert::*peers)() const = &dht_get_peers_reply_alert::peers;
|
||||||
|
|
||||||
class_<dht_get_peers_reply_alert, bases<alert>, noncopyable>(
|
class_<dht_get_peers_reply_alert, bases<alert>, noncopyable>(
|
||||||
|
|
|
@ -496,20 +496,21 @@ class test_session(unittest.TestCase):
|
||||||
self.assertEqual(s.get_settings()['user_agent'], 'test123')
|
self.assertEqual(s.get_settings()['user_agent'], 'test123')
|
||||||
|
|
||||||
def test_post_session_stats(self):
|
def test_post_session_stats(self):
|
||||||
s = lt.session(settings)
|
s = lt.session({'alert_mask': lt.alert.category_t.stats_notification, 'enable_dht': False})
|
||||||
s.post_session_stats()
|
s.post_session_stats()
|
||||||
alerts = []
|
alerts = []
|
||||||
# first the stats headers log line. but not if logging is disabled
|
# first the stats headers log line. but not if logging is disabled
|
||||||
if 'log_alert' in [i[0] for i in inspect.getmembers(lt)]:
|
s.wait_for_alert(1000)
|
||||||
s.wait_for_alert(1000)
|
alerts = s.pop_alerts()
|
||||||
alerts = s.pop_alerts()
|
a = alerts.pop(0)
|
||||||
a = alerts.pop(0)
|
print(a)
|
||||||
self.assertTrue(isinstance(a, lt.log_alert))
|
self.assertTrue(isinstance(a, lt.session_stats_header_alert))
|
||||||
# then the actual stats values
|
# then the actual stats values
|
||||||
if len(alerts) == 0:
|
if len(alerts) == 0:
|
||||||
s.wait_for_alert(1000)
|
s.wait_for_alert(1000)
|
||||||
alerts = s.pop_alerts()
|
alerts = s.pop_alerts()
|
||||||
a = alerts.pop(0)
|
a = alerts.pop(0)
|
||||||
|
print(a)
|
||||||
self.assertTrue(isinstance(a, lt.session_stats_alert))
|
self.assertTrue(isinstance(a, lt.session_stats_alert))
|
||||||
self.assertTrue(isinstance(a.values, dict))
|
self.assertTrue(isinstance(a.values, dict))
|
||||||
self.assertTrue(len(a.values) > 0)
|
self.assertTrue(len(a.values) > 0)
|
||||||
|
|
Loading…
Reference in New Issue