Implement Gitea CI and real statement imports
Gitea Actions CI / detect (push) Successful in 3s
Gitea Actions CI / Compose & nginx validation (push) Failing after 20s
Gitea Actions CI / Frontend (lint / type / test / build) (push) Failing after 24s
Gitea Actions CI / Backend (lint / type / test / build) (push) Failing after 1m34s
Gitea Actions CI / detect (push) Successful in 3s
Gitea Actions CI / Compose & nginx validation (push) Failing after 20s
Gitea Actions CI / Frontend (lint / type / test / build) (push) Failing after 24s
Gitea Actions CI / Backend (lint / type / test / build) (push) Failing after 1m34s
This commit is contained in:
@@ -9,6 +9,7 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.db.session import set_space_context
|
||||
from app.imports.blob import get_blob_store
|
||||
from app.imports.models import HoldResolution, ParseRun, SourceRecord, StatementDocument
|
||||
from app.ledger.models import Account
|
||||
from app.spaces.models import FinancialSpace
|
||||
|
||||
@@ -28,11 +29,55 @@ def test_postgres_rls_requires_matching_transaction_context() -> None:
|
||||
db.rollback()
|
||||
|
||||
set_space_context(db, space_id)
|
||||
db.add(Account(space_id=space_id, name="Allowed", kind="cash", opened_on=date.today()))
|
||||
account = Account(space_id=space_id, name="Allowed", kind="cash", opened_on=date.today())
|
||||
db.add(account)
|
||||
db.flush()
|
||||
document = StatementDocument(
|
||||
space_id=space_id,
|
||||
account_id=account.id,
|
||||
original_filename="synthetic.xlsx",
|
||||
size_bytes=1,
|
||||
content_sha256=uuid.uuid4().hex + uuid.uuid4().hex,
|
||||
object_key=uuid.uuid4().hex,
|
||||
status="confirmed",
|
||||
)
|
||||
db.add(document)
|
||||
db.flush()
|
||||
run = ParseRun(
|
||||
space_id=space_id,
|
||||
document_id=document.id,
|
||||
adapter_id="alfa_debit_xlsx",
|
||||
status="succeeded",
|
||||
)
|
||||
db.add(run)
|
||||
db.flush()
|
||||
document.active_parse_run_id = run.id
|
||||
hold = SourceRecord(
|
||||
space_id=space_id,
|
||||
document_id=document.id,
|
||||
parse_run_id=run.id,
|
||||
occurred_on=date.today(),
|
||||
amount_kopecks=100,
|
||||
direction="out",
|
||||
bank_status="hold",
|
||||
row_ref="sheet0:row1",
|
||||
record_fp=uuid.uuid4().hex,
|
||||
)
|
||||
db.add(hold)
|
||||
db.flush()
|
||||
db.add(
|
||||
HoldResolution(
|
||||
space_id=space_id,
|
||||
hold_source_record_id=hold.id,
|
||||
resolution="discarded_as_cancelled",
|
||||
reason="synthetic test resolution",
|
||||
)
|
||||
)
|
||||
db.commit()
|
||||
|
||||
set_space_context(db, uuid.uuid4())
|
||||
assert db.query(Account).count() == 0
|
||||
assert db.query(HoldResolution).count() == 0
|
||||
db.rollback()
|
||||
set_space_context(db, space_id)
|
||||
persisted_space = db.get(FinancialSpace, space_id)
|
||||
|
||||
Reference in New Issue
Block a user