(fixtures, tmp_path: Path)
| 110 | |
| 111 | |
| 112 | def test_sqlite_scan_output(fixtures, tmp_path: Path): |
| 113 | scan_path = str(fixtures.path("flask_app.py")) |
| 114 | db_path = tmp_path / "aura_test_output.sqlite" |
| 115 | _ = fixtures.get_cli_output( |
| 116 | ['scan', scan_path, '--format', f'sqlite://{db_path}'] |
| 117 | ) |
| 118 | db = sqlite3.connect(db_path) |
| 119 | db.row_factory = sqlite3.Row |
| 120 | |
| 121 | inputs = [dict(x) for x in db.execute( |
| 122 | "SELECT * FROM inputs WHERE input=?", |
| 123 | (scan_path,) |
| 124 | ).fetchall()] |
| 125 | assert len(inputs) == 1 |
| 126 | |
| 127 | input_id = inputs[0]["id"] |
| 128 | |
| 129 | locations = [dict(x) for x in db.execute("SELECT * FROM locations").fetchall()] |
| 130 | |
| 131 | assert len(locations) == 1 |
| 132 | for loc in locations: |
| 133 | assert loc["input"] == input_id |
| 134 | |
| 135 | loc_id = locations[0]["id"] |
| 136 | |
| 137 | detections = [dict(x) for x in db.execute("SELECT * FROM detections").fetchall()] |
| 138 | assert len(detections) > 3 |
| 139 | for d in detections: |
| 140 | assert d["location"] == loc_id |
| 141 | |
| 142 | |
| 143 | def test_non_existing(fixtures): |
nothing calls this directly
no test coverage detected