Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024-09-27 | MAIN --> PROD | DEV (773d171) --> STAGING #4330

Merged
merged 6 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# FOUNDATION
###############################

FROM python:3.11-slim AS foundation
FROM python:3.12-slim AS foundation

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN apt-get -yq update && \
apt install -y \
apt-transport-https \
apt-transport-https \
build-essential \
ca-certificates \
chromium \
Expand All @@ -19,7 +19,7 @@ RUN apt-get -yq update && \
gnupg \
gnupg2 \
postgresql-client \
wget
wget

###############################
# STORAGE
Expand Down Expand Up @@ -62,7 +62,7 @@ RUN npm ci && \

COPY . /src/

RUN npm run build
RUN npm run build

###############################
# DEV
Expand Down
12 changes: 6 additions & 6 deletions backend/api/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,14 @@ def test_expected_fields_included(self):

serializer = AccessListSerializer(access)

self.assertEquals(serializer.data["auditee_uei"], access.sac.auditee_uei)
self.assertEquals(
self.assertEqual(serializer.data["auditee_uei"], access.sac.auditee_uei)
self.assertEqual(
serializer.data["auditee_fiscal_period_end"],
access.sac.auditee_fiscal_period_end,
)
self.assertEquals(serializer.data["auditee_name"], access.sac.auditee_name)
self.assertEquals(serializer.data["report_id"], access.sac.report_id)
self.assertEquals(
self.assertEqual(serializer.data["auditee_name"], access.sac.auditee_name)
self.assertEqual(serializer.data["report_id"], access.sac.report_id)
self.assertEqual(
serializer.data["submission_status"], access.sac.submission_status
)
self.assertEquals(serializer.data["role"], access.role)
self.assertEqual(serializer.data["role"], access.role)
12 changes: 6 additions & 6 deletions backend/api/test_uei.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def test_get_uei_info_from_sam_gov(self):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["SAM.gov API response status code invalid: 400"],
)
Expand All @@ -520,7 +520,7 @@ def bad_timeout(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(results["errors"], ["SAM.gov API timeout"])
self.assertEqual(results["errors"], ["SAM.gov API timeout"])

# TooManyRedirects
with patch("api.uei.SESSION.get") as mock_get:
Expand All @@ -533,7 +533,7 @@ def bad_redirects(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"], ["SAM.gov API error - too many redirects"]
)

Expand All @@ -548,7 +548,7 @@ def bad_reqexception(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["Unable to make SAM.gov API request, error: "],
)
Expand All @@ -574,7 +574,7 @@ def bad_reqexception(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["UEI was not found in SAM.gov"],
)
Expand Down Expand Up @@ -609,7 +609,7 @@ def bad_reqexception(*args, **kwds):

self.assertFalse(results["valid"])
self.assertTrue(results["errors"])
self.assertEquals(
self.assertEqual(
results["errors"],
["UEI was not found in SAM.gov"],
)
Expand Down
42 changes: 17 additions & 25 deletions backend/audit/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
SacValidationWaiver,
UeiValidationWaiver,
)
from audit.models.models import STATUS
from audit.models.viewflow import sac_transition
from audit.validators import (
validate_auditee_certification_json,
validate_auditor_certification_json,
Expand Down Expand Up @@ -154,8 +156,8 @@ def save_model(self, request, obj, form, change):
try:
sac = SingleAuditChecklist.objects.get(report_id=obj.report_id_id)
if sac.submission_status in [
SingleAuditChecklist.STATUS.READY_FOR_CERTIFICATION,
SingleAuditChecklist.STATUS.AUDITOR_CERTIFIED,
STATUS.READY_FOR_CERTIFICATION,
STATUS.AUDITOR_CERTIFIED,
]:
logger.info(
f"User {request.user.email} is applying waiver for SAC with status: {sac.submission_status}"
Expand All @@ -167,7 +169,7 @@ def save_model(self, request, obj, form, change):
f"SAC {sac.report_id} updated successfully with waiver by user: {request.user.email}."
)
elif (
SingleAuditChecklist.STATUS.IN_PROGRESS
STATUS.IN_PROGRESS
and SacValidationWaiver.TYPES.FINDING_REFERENCE_NUMBER
in obj.waiver_types
):
Expand All @@ -182,7 +184,7 @@ def save_model(self, request, obj, form, change):
messages.set_level(request, messages.WARNING)
messages.warning(
request,
f"Cannot apply waiver to SAC with status {sac.submission_status}. Expected status to be one of {SingleAuditChecklist.STATUS.READY_FOR_CERTIFICATION}, {SingleAuditChecklist.STATUS.AUDITOR_CERTIFIED}, or {SingleAuditChecklist.STATUS.IN_PROGRESS}.",
f"Cannot apply waiver to SAC with status {sac.submission_status}. Expected status to be one of {STATUS.READY_FOR_CERTIFICATION}, {STATUS.AUDITOR_CERTIFIED}, or {STATUS.IN_PROGRESS}.",
)
logger.warning(
f"User {request.user.email} attempted to apply waiver to SAC with invalid status: {sac.submission_status}"
Expand Down Expand Up @@ -218,20 +220,13 @@ def handle_auditor_certification(self, request, obj, sac):
},
}
)
if (
sac.submission_status
== SingleAuditChecklist.STATUS.READY_FOR_CERTIFICATION
):
if sac.submission_status == STATUS.READY_FOR_CERTIFICATION:
validated = validate_auditor_certification_json(auditor_certification)
sac.auditor_certification = validated
sac.transition_to_auditor_certified()
sac.save(
event_user=request.user,
event_type=SubmissionEvent.EventType.AUDITOR_CERTIFICATION_COMPLETED,
)
logger.info(
f"Auditor certification completed for SAC {sac.report_id} by user: {request.user.email}."
)
if sac_transition(request, sac, transition_to=STATUS.AUDITOR_CERTIFIED):
logger.info(
f"Auditor certification completed for SAC {sac.report_id} by user: {request.user.email}."
)

def handle_auditee_certification(self, request, obj, sac):
if SacValidationWaiver.TYPES.AUDITEE_CERTIFYING_OFFICIAL in obj.waiver_types:
Expand All @@ -257,17 +252,14 @@ def handle_auditee_certification(self, request, obj, sac):
},
}
)
if sac.submission_status == SingleAuditChecklist.STATUS.AUDITOR_CERTIFIED:
if sac.submission_status == STATUS.AUDITOR_CERTIFIED:
validated = validate_auditee_certification_json(auditee_certification)
sac.auditee_certification = validated
sac.transition_to_auditee_certified()
sac.save(
event_user=request.user,
event_type=SubmissionEvent.EventType.AUDITEE_CERTIFICATION_COMPLETED,
)
logger.info(
f"Auditee certification completed for SAC {sac.report_id} by user: {request.user.email}."
)

if sac_transition(request, sac, transition_to=STATUS.AUDITEE_CERTIFIED):
logger.info(
f"Auditee certification completed for SAC {sac.report_id} by user: {request.user.email}."
)


class UeiValidationWaiverAdmin(admin.ModelAdmin):
Expand Down
2 changes: 1 addition & 1 deletion backend/audit/intake_to_dissemination.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def load_general(self):
oversight_agency = self.single_audit_checklist.oversight_agency

dates_by_status = self._get_dates_from_sac()
status = self.single_audit_checklist.STATUS
status = self.single_audit_checklist.get_statuses()
ready_for_certification_date = dates_by_status[status.READY_FOR_CERTIFICATION]
if self.mode == IntakeToDissemination.DISSEMINATION:
submitted_date = self._convert_utc_to_american_samoa_zone(
Expand Down
47 changes: 47 additions & 0 deletions backend/audit/migrations/0013_singleauditchecklistflow_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 5.1 on 2024-09-18 18:44

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("audit", "0012_alter_sacvalidationwaiver_waiver_types"),
]

operations = [
migrations.CreateModel(
name="SingleAuditChecklistFlow",
fields=[
(
"singleauditchecklist_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="audit.singleauditchecklist",
),
),
],
bases=("audit.singleauditchecklist",),
),
migrations.AlterField(
model_name="singleauditchecklist",
name="submission_status",
field=models.CharField(
choices=[
("in_progress", "In Progress"),
("ready_for_certification", "Ready for Certification"),
("auditor_certified", "Auditor Certified"),
("auditee_certified", "Auditee Certified"),
("certified", "Certified"),
("submitted", "Submitted"),
("disseminated", "Disseminated"),
],
default="in_progress",
),
),
]
Loading
Loading