(fixtures, fuzzy_rule_match, tmp_path)
| 334 | |
| 335 | @pytest.mark.e2e |
| 336 | def test_diff_sqlite_output_e2e(fixtures, fuzzy_rule_match, tmp_path): |
| 337 | pth1 = fixtures.path("diffs/1_a") |
| 338 | pth2 = fixtures.path("diffs/1_b") |
| 339 | db_path = tmp_path / "aura_test_diff_output.sqlite" |
| 340 | |
| 341 | try: |
| 342 | _ = fixtures.get_cli_output(["diff", pth1, pth2, "-f", f"sqlite://{db_path}"]) |
| 343 | except FeatureDisabled as exc: |
| 344 | pytest.mark.skipif(reason=exc.args[0]) |
| 345 | |
| 346 | db = sqlite3.connect(db_path) |
| 347 | db.row_factory = sqlite3.Row |
| 348 | |
| 349 | diffs = [dict(x) for x in db.execute("SELECT * FROM diffs").fetchall()] |
| 350 | diff_ids = {x["id"]: x for x in diffs} |
| 351 | |
| 352 | detections = [dict(x) for x in db.execute("SELECT * FROM detections").fetchall()] |
| 353 | |
| 354 | for d in detections: |
| 355 | if d["is_new"]: |
| 356 | diff_ids[d["diff"]].setdefault("new_detections", []).append(d) |
| 357 | else: |
| 358 | diff_ids[d["diff"]].setdefault("removed_detections", []).append(d) |
| 359 | |
| 360 | for match in DIFF_MATCHES: |
| 361 | assert any(fuzzy_rule_match(x, match) for x in diffs), (match, diffs) |
| 362 | |
| 363 | |
| 364 | @pytest.mark.skipif(jsonschema is None, reason="jsonschema module is not installed") |
nothing calls this directly
no test coverage detected