MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / test_flush_moves_to_sent_log

Function test_flush_moves_to_sent_log

tests/test_telemetry.py:137–157  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

135
136
137def test_flush_moves_to_sent_log(tmp_path):
138 _reset(tmp_path)
139 telem.enable()
140
141 # Buffer a record
142 rec = telem.TelemetryRecord(predicted_tier=0, outcome="success")
143 telem.buffer_record(rec)
144 assert telem.status()["pending_records"] == 1
145
146 # Mock successful send
147 with mock.patch.object(telem, "_send_batch", return_value=True):
148 count = telem.flush()
149
150 assert count == 1
151 assert telem.status()["pending_records"] == 0
152 assert telem.status()["total_sent"] == 1
153
154 # Verify sent log
155 sent = telem.get_sent_records()
156 assert len(sent) == 1
157 assert sent[0]["predicted_tier"] == 0
158
159
160def test_flush_on_failure_keeps_buffer(tmp_path):

Callers

nothing calls this directly

Calls 2

_resetFunction · 0.85
statusMethod · 0.45

Tested by

no test coverage detected