def test_stream_count_with_role(self, fixture_db_session, simple_populated_db): """ Assumes fake packets all belong to one stream. """ roles_insert = set( (v.attrib['role'] for v in simple_populated_db.insert_packets)) q = query.stream_counts_role_breakdown_q(fixture_db_session) rb = convenience.to_nested_dict(q.all()) assert len(rb) == len(simple_populated_db.stream_set) n_total_ivorn = 0 for stream_breakdown in rb.values(): for role_count in stream_breakdown.values(): n_total_ivorn += role_count assert n_total_ivorn == simple_populated_db.n_inserts
def test_stream_count_with_role(self, fixture_db_session, simple_populated_db): """ Assumes fake packets all belong to one stream. """ roles_insert = set( (v.attrib['role'] for v in simple_populated_db.insert_packets)) q = query.stream_counts_role_breakdown_q(fixture_db_session) rb = convenience.to_nested_dict(q.all()) assert len(rb) == len(simple_populated_db.stream_set) n_total_ivorn = 0 for stream_breakdown in rb.values(): for role_count in stream_breakdown.values(): n_total_ivorn +=role_count assert n_total_ivorn == simple_populated_db.n_inserts
def get_query(self): return query.stream_counts_role_breakdown_q(db_session)