Skip to content

Commit

Permalink
Remove error handlers
Browse files Browse the repository at this point in the history
* because we are only unit testing the BLL and not the DAL currently,
  these handlers cause test coverage to dip from 100% to 99.88%.
  • Loading branch information
madwort committed Mar 15, 2024
1 parent 3ea0bd9 commit b97caae
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions local_db/data_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,12 @@ def get_file_approvals(self, request_id):

def approve_file(self, request_id, user, relpath):
with transaction.atomic():
try:
request_file = RequestFileMetadata.objects.get(
filegroup__request_id=request_id, relpath=relpath
)
except RequestFileMetadata.DoesNotExist:
raise BusinessLogicLayer.FileNotFound(
f"file {relpath} not part of a request {request_id}"
)
# nb. the business logic layer approve_file() should confirm that this path
# is part of the request before calling this method
request_file = RequestFileMetadata.objects.get(
filegroup__request_id=request_id, relpath=relpath
)

review, _ = FileReview.objects.get_or_create(
file=request_file, reviewer=user
)
Expand All @@ -170,14 +168,10 @@ def approve_file(self, request_id, user, relpath):

def reject_file(self, request_id, user, relpath):
with transaction.atomic():
try:
request_file = RequestFileMetadata.objects.get(
filegroup__request_id=request_id, relpath=relpath
)
except RequestFileMetadata.DoesNotExist:
raise BusinessLogicLayer.FileNotFound(
f"file {relpath} not part of a request {request_id}"
)
request_file = RequestFileMetadata.objects.get(
filegroup__request_id=request_id, relpath=relpath
)

review, _ = FileReview.objects.get_or_create(
file=request_file, reviewer=user
)
Expand Down

0 comments on commit b97caae

Please sign in to comment.