Add assertNumEvents method and use assertFieldEquals

This commit is contained in:
Christophe Bedard 2019-06-23 12:56:50 +02:00
parent 4b1545ccb4
commit 0abddffeff
7 changed files with 52 additions and 41 deletions

View file

@ -54,13 +54,13 @@ class TestSubscription(TraceTestCase):
'topic_name',
'/the_topic',
sub_init_events)
self.assertEqual(len(test_sub_init_events), 1, 'cannot find test topic name')
self.assertNumEvents(test_sub_init_events, 1, 'cannot find test topic name')
test_sub_init_event = test_sub_init_events[0]
# Check queue_depth value
test_queue_depth = self.get_field(test_sub_init_event, 'queue_depth')
self.assertEqual(
test_queue_depth,
self.assertFieldEquals(
test_sub_init_event,
'queue_depth',
10,
'sub_init event does not have expected queue depth value')
@ -69,8 +69,8 @@ class TestSubscription(TraceTestCase):
test_sub_node_init_events = self.get_events_with_procname(
'test_subscription',
node_init_events)
self.assertEqual(
len(test_sub_node_init_events),
self.assertNumEvents(
test_sub_node_init_events,
1,
'none or more than 1 node_init event')
test_sub_node_init_event = test_sub_node_init_events[0]